2022-06-08 01:36:46 +02:00
|
|
|
// Copyright (c) 2018-2022 The Dash Core developers
|
2018-02-13 13:36:36 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2018-04-02 00:30:17 +02:00
|
|
|
#ifndef BITCOIN_EVO_PROVIDERTX_H
|
|
|
|
#define BITCOIN_EVO_PROVIDERTX_H
|
2018-02-13 13:36:36 +01:00
|
|
|
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <bls/bls.h>
|
2022-02-26 19:50:35 +01:00
|
|
|
#include <evo/specialtx.h>
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <primitives/transaction.h>
|
|
|
|
|
2022-06-12 11:08:53 +02:00
|
|
|
#include <consensus/validation.h>
|
2023-02-14 19:48:33 +01:00
|
|
|
#include <evo/dmn_types.h>
|
Merge #11372: Address encoding cleanup
92f1f8b31 Split off key_io_tests from base58_tests (Pieter Wuille)
119b0f85e Split key_io (address/key encodings) off from base58 (Pieter Wuille)
ebfe217b1 Stop using CBase58Data for ext keys (Pieter Wuille)
32e69fa0d Replace CBitcoinSecret with {Encode,Decode}Secret (Pieter Wuille)
Pull request description:
This PR contains some of the changes left as TODO in #11167 (and built on top of that PR). They are not intended for backporting.
This removes the `CBase58`, `CBitcoinSecret`, `CBitcoinExtKey`, and `CBitcoinExtPubKey` classes, in favor of simple `Encode`/`Decode` functions. Furthermore, all Bitcoin-specific logic (addresses, WIF, BIP32) is moved to `key_io.{h,cpp}`, leaving `base58.{h,cpp}` as a pure utility that implements the base58 encoding/decoding logic.
Tree-SHA512: a5962c0ed27ad53cbe00f22af432cf11aa530e3efc9798e25c004bc9ed1b5673db5df3956e398ee2c085e3a136ac8da69fe7a7d97a05fb2eb3be0b60d0479655
Make linter happy
Dashify
2018-03-07 00:04:56 +01:00
|
|
|
#include <key_io.h>
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <netaddress.h>
|
|
|
|
#include <pubkey.h>
|
2023-02-03 06:22:51 +01:00
|
|
|
#include <tinyformat.h>
|
2020-03-19 23:46:56 +01:00
|
|
|
#include <univalue.h>
|
2023-02-20 11:12:12 +01:00
|
|
|
#include <util/underlying.h>
|
2018-02-13 13:36:36 +01:00
|
|
|
|
|
|
|
class CBlockIndex;
|
2021-04-03 19:18:50 +02:00
|
|
|
class CCoinsViewCache;
|
2019-10-30 15:27:22 +01:00
|
|
|
class TxValidationState;
|
2018-02-13 13:36:36 +01:00
|
|
|
|
|
|
|
class CProRegTx
|
|
|
|
{
|
|
|
|
public:
|
2022-03-06 07:54:26 +01:00
|
|
|
static constexpr auto SPECIALTX_TYPE = TRANSACTION_PROVIDER_REGISTER;
|
2022-12-30 06:45:31 +01:00
|
|
|
static constexpr uint16_t LEGACY_BLS_VERSION = 1;
|
|
|
|
static constexpr uint16_t BASIC_BLS_VERSION = 2;
|
2018-02-13 13:36:36 +01:00
|
|
|
|
2022-12-30 06:45:31 +01:00
|
|
|
[[nodiscard]] static constexpr auto GetVersion(const bool is_basic_scheme_active) -> uint16_t
|
|
|
|
{
|
|
|
|
return is_basic_scheme_active ? BASIC_BLS_VERSION : LEGACY_BLS_VERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t nVersion{LEGACY_BLS_VERSION}; // message version
|
2023-02-16 13:05:01 +01:00
|
|
|
MnType nType{MnType::Regular};
|
2018-11-06 09:54:23 +01:00
|
|
|
uint16_t nMode{0}; // only 0 supported for now
|
2018-10-25 16:29:50 +02:00
|
|
|
COutPoint collateralOutpoint{uint256(), (uint32_t)-1}; // if hash is null, we refer to a ProRegTx output
|
2018-02-13 13:36:36 +01:00
|
|
|
CService addr;
|
2023-02-14 19:48:33 +01:00
|
|
|
uint160 platformNodeID{};
|
|
|
|
uint16_t platformP2PPort{0};
|
|
|
|
uint16_t platformHTTPPort{0};
|
2018-02-13 13:36:36 +01:00
|
|
|
CKeyID keyIDOwner;
|
2018-10-21 21:45:16 +02:00
|
|
|
CBLSPublicKey pubKeyOperator;
|
2018-02-13 13:36:36 +01:00
|
|
|
CKeyID keyIDVoting;
|
|
|
|
uint16_t nOperatorReward{0};
|
|
|
|
CScript scriptPayout;
|
|
|
|
uint256 inputsHash; // replay protection
|
|
|
|
std::vector<unsigned char> vchSig;
|
|
|
|
|
2021-05-27 17:17:29 +02:00
|
|
|
SERIALIZE_METHODS(CProRegTx, obj)
|
2018-02-13 13:36:36 +01:00
|
|
|
{
|
2021-05-27 17:17:29 +02:00
|
|
|
READWRITE(
|
2022-12-30 06:45:31 +01:00
|
|
|
obj.nVersion
|
|
|
|
);
|
|
|
|
if (obj.nVersion == 0 || obj.nVersion > BASIC_BLS_VERSION) {
|
|
|
|
// unknown version, bail out early
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
READWRITE(
|
2021-05-27 17:17:29 +02:00
|
|
|
obj.nType,
|
|
|
|
obj.nMode,
|
|
|
|
obj.collateralOutpoint,
|
|
|
|
obj.addr,
|
|
|
|
obj.keyIDOwner,
|
2022-12-30 06:45:31 +01:00
|
|
|
CBLSPublicKeyVersionWrapper(const_cast<CBLSPublicKey&>(obj.pubKeyOperator), (obj.nVersion == LEGACY_BLS_VERSION)),
|
2021-05-27 17:17:29 +02:00
|
|
|
obj.keyIDVoting,
|
|
|
|
obj.nOperatorReward,
|
|
|
|
obj.scriptPayout,
|
|
|
|
obj.inputsHash
|
2022-12-30 06:45:31 +01:00
|
|
|
);
|
2023-02-16 13:05:01 +01:00
|
|
|
if (obj.nVersion == BASIC_BLS_VERSION && obj.nType == MnType::HighPerformance) {
|
2023-02-14 19:48:33 +01:00
|
|
|
READWRITE(
|
|
|
|
obj.platformNodeID,
|
|
|
|
obj.platformP2PPort,
|
|
|
|
obj.platformHTTPPort);
|
|
|
|
}
|
2018-02-13 13:36:36 +01:00
|
|
|
if (!(s.GetType() & SER_GETHASH)) {
|
2021-05-27 17:17:29 +02:00
|
|
|
READWRITE(obj.vchSig);
|
2018-02-13 13:36:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-01 22:57:10 +01:00
|
|
|
// When signing with the collateral key, we don't sign the hash but a generated message instead
|
|
|
|
// This is needed for HW wallet support which can only sign text messages as of now
|
|
|
|
std::string MakeSignString() const;
|
|
|
|
|
2018-02-13 13:36:36 +01:00
|
|
|
std::string ToString() const;
|
2019-06-11 13:42:17 +02:00
|
|
|
|
|
|
|
void ToJson(UniValue& obj) const
|
|
|
|
{
|
|
|
|
obj.clear();
|
|
|
|
obj.setObject();
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("version", nVersion);
|
2023-02-20 11:12:12 +01:00
|
|
|
obj.pushKV("type", ToUnderlying(nType));
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("collateralHash", collateralOutpoint.hash.ToString());
|
|
|
|
obj.pushKV("collateralIndex", (int)collateralOutpoint.n);
|
|
|
|
obj.pushKV("service", addr.ToString(false));
|
2019-05-09 18:04:52 +02:00
|
|
|
obj.pushKV("ownerAddress", EncodeDestination(PKHash(keyIDOwner)));
|
|
|
|
obj.pushKV("votingAddress", EncodeDestination(PKHash(keyIDVoting)));
|
2019-06-11 13:42:17 +02:00
|
|
|
|
|
|
|
CTxDestination dest;
|
|
|
|
if (ExtractDestination(scriptPayout, dest)) {
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("payoutAddress", EncodeDestination(dest));
|
2019-06-11 13:42:17 +02:00
|
|
|
}
|
2022-12-30 06:45:31 +01:00
|
|
|
obj.pushKV("pubKeyOperator", pubKeyOperator.ToString(nVersion == LEGACY_BLS_VERSION));
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("operatorReward", (double)nOperatorReward / 100);
|
2023-02-16 13:05:01 +01:00
|
|
|
if (nType == MnType::HighPerformance) {
|
2023-02-14 19:48:33 +01:00
|
|
|
obj.pushKV("platformNodeID", platformNodeID.ToString());
|
|
|
|
obj.pushKV("platformP2PPort", platformP2PPort);
|
|
|
|
obj.pushKV("platformHTTPPort", platformHTTPPort);
|
|
|
|
}
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("inputsHash", inputsHash.ToString());
|
2019-06-11 13:42:17 +02:00
|
|
|
}
|
2022-02-26 19:50:35 +01:00
|
|
|
|
2022-12-30 06:45:31 +01:00
|
|
|
maybe_error IsTriviallyValid(bool is_bls_legacy_scheme) const;
|
2018-02-13 13:36:36 +01:00
|
|
|
};
|
|
|
|
|
2018-03-12 12:14:11 +01:00
|
|
|
class CProUpServTx
|
|
|
|
{
|
|
|
|
public:
|
2022-03-06 07:54:26 +01:00
|
|
|
static constexpr auto SPECIALTX_TYPE = TRANSACTION_PROVIDER_UPDATE_SERVICE;
|
2022-12-30 06:45:31 +01:00
|
|
|
static constexpr uint16_t LEGACY_BLS_VERSION = 1;
|
|
|
|
static constexpr uint16_t BASIC_BLS_VERSION = 2;
|
|
|
|
|
|
|
|
[[nodiscard]] static constexpr auto GetVersion(const bool is_basic_scheme_active) -> uint16_t
|
|
|
|
{
|
|
|
|
return is_basic_scheme_active ? BASIC_BLS_VERSION : LEGACY_BLS_VERSION;
|
|
|
|
}
|
2018-03-12 12:14:11 +01:00
|
|
|
|
2022-12-30 06:45:31 +01:00
|
|
|
uint16_t nVersion{LEGACY_BLS_VERSION}; // message version
|
2023-02-16 13:05:01 +01:00
|
|
|
MnType nType{MnType::Regular};
|
2018-03-12 12:14:11 +01:00
|
|
|
uint256 proTxHash;
|
|
|
|
CService addr;
|
2023-02-14 19:48:33 +01:00
|
|
|
uint160 platformNodeID{};
|
|
|
|
uint16_t platformP2PPort{0};
|
|
|
|
uint16_t platformHTTPPort{0};
|
2018-03-12 12:14:11 +01:00
|
|
|
CScript scriptOperatorPayout;
|
|
|
|
uint256 inputsHash; // replay protection
|
2018-10-21 21:45:16 +02:00
|
|
|
CBLSSignature sig;
|
2018-03-12 12:14:11 +01:00
|
|
|
|
2021-05-27 17:17:29 +02:00
|
|
|
SERIALIZE_METHODS(CProUpServTx, obj)
|
2018-03-12 12:14:11 +01:00
|
|
|
{
|
2022-12-30 06:45:31 +01:00
|
|
|
READWRITE(
|
|
|
|
obj.nVersion
|
|
|
|
);
|
|
|
|
if (obj.nVersion == 0 || obj.nVersion > BASIC_BLS_VERSION) {
|
|
|
|
// unknown version, bail out early
|
|
|
|
return;
|
|
|
|
}
|
2023-02-14 19:48:33 +01:00
|
|
|
if (obj.nVersion == BASIC_BLS_VERSION) {
|
|
|
|
READWRITE(
|
|
|
|
obj.nType);
|
|
|
|
}
|
2022-12-30 06:45:31 +01:00
|
|
|
READWRITE(
|
|
|
|
obj.proTxHash,
|
|
|
|
obj.addr,
|
|
|
|
obj.scriptOperatorPayout,
|
|
|
|
obj.inputsHash
|
|
|
|
);
|
2023-02-16 13:05:01 +01:00
|
|
|
if (obj.nVersion == BASIC_BLS_VERSION && obj.nType == MnType::HighPerformance) {
|
2023-02-14 19:48:33 +01:00
|
|
|
READWRITE(
|
|
|
|
obj.platformNodeID,
|
|
|
|
obj.platformP2PPort,
|
|
|
|
obj.platformHTTPPort);
|
|
|
|
}
|
2018-03-12 12:14:11 +01:00
|
|
|
if (!(s.GetType() & SER_GETHASH)) {
|
2022-12-30 06:45:31 +01:00
|
|
|
READWRITE(
|
|
|
|
CBLSSignatureVersionWrapper(const_cast<CBLSSignature&>(obj.sig), (obj.nVersion == LEGACY_BLS_VERSION), true)
|
|
|
|
);
|
2018-03-12 12:14:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string ToString() const;
|
2019-06-11 13:42:17 +02:00
|
|
|
|
|
|
|
void ToJson(UniValue& obj) const
|
|
|
|
{
|
|
|
|
obj.clear();
|
|
|
|
obj.setObject();
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("version", nVersion);
|
2023-02-20 11:12:12 +01:00
|
|
|
obj.pushKV("type", ToUnderlying(nType));
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("proTxHash", proTxHash.ToString());
|
|
|
|
obj.pushKV("service", addr.ToString(false));
|
2019-06-11 13:42:17 +02:00
|
|
|
CTxDestination dest;
|
|
|
|
if (ExtractDestination(scriptOperatorPayout, dest)) {
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("operatorPayoutAddress", EncodeDestination(dest));
|
2019-06-11 13:42:17 +02:00
|
|
|
}
|
2023-02-16 13:05:01 +01:00
|
|
|
if (nType == MnType::HighPerformance) {
|
2023-02-14 19:48:33 +01:00
|
|
|
obj.pushKV("platformNodeID", platformNodeID.ToString());
|
|
|
|
obj.pushKV("platformP2PPort", platformP2PPort);
|
|
|
|
obj.pushKV("platformHTTPPort", platformHTTPPort);
|
|
|
|
}
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("inputsHash", inputsHash.ToString());
|
2019-06-11 13:42:17 +02:00
|
|
|
}
|
2022-02-26 19:50:35 +01:00
|
|
|
|
2022-12-30 06:45:31 +01:00
|
|
|
maybe_error IsTriviallyValid(bool is_bls_legacy_scheme) const;
|
2018-03-12 12:14:11 +01:00
|
|
|
};
|
|
|
|
|
2018-03-19 08:44:00 +01:00
|
|
|
class CProUpRegTx
|
|
|
|
{
|
|
|
|
public:
|
2022-03-06 07:54:26 +01:00
|
|
|
static constexpr auto SPECIALTX_TYPE = TRANSACTION_PROVIDER_UPDATE_REGISTRAR;
|
2022-12-30 06:45:31 +01:00
|
|
|
static constexpr uint16_t LEGACY_BLS_VERSION = 1;
|
|
|
|
static constexpr uint16_t BASIC_BLS_VERSION = 2;
|
2018-03-19 08:44:00 +01:00
|
|
|
|
2022-12-30 06:45:31 +01:00
|
|
|
[[nodiscard]] static constexpr auto GetVersion(const bool is_basic_scheme_active) -> uint16_t
|
|
|
|
{
|
|
|
|
return is_basic_scheme_active ? BASIC_BLS_VERSION : LEGACY_BLS_VERSION;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint16_t nVersion{LEGACY_BLS_VERSION}; // message version
|
2018-03-19 08:44:00 +01:00
|
|
|
uint256 proTxHash;
|
2018-10-23 13:15:38 +02:00
|
|
|
uint16_t nMode{0}; // only 0 supported for now
|
2018-10-21 21:45:16 +02:00
|
|
|
CBLSPublicKey pubKeyOperator;
|
2018-03-19 08:44:00 +01:00
|
|
|
CKeyID keyIDVoting;
|
|
|
|
CScript scriptPayout;
|
|
|
|
uint256 inputsHash; // replay protection
|
|
|
|
std::vector<unsigned char> vchSig;
|
|
|
|
|
2021-05-27 17:17:29 +02:00
|
|
|
SERIALIZE_METHODS(CProUpRegTx, obj)
|
2018-03-19 08:44:00 +01:00
|
|
|
{
|
2021-05-27 17:17:29 +02:00
|
|
|
READWRITE(
|
2022-12-30 06:45:31 +01:00
|
|
|
obj.nVersion
|
|
|
|
);
|
|
|
|
if (obj.nVersion == 0 || obj.nVersion > BASIC_BLS_VERSION) {
|
|
|
|
// unknown version, bail out early
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
READWRITE(
|
2021-05-27 17:17:29 +02:00
|
|
|
obj.proTxHash,
|
|
|
|
obj.nMode,
|
2022-12-30 06:45:31 +01:00
|
|
|
CBLSPublicKeyVersionWrapper(const_cast<CBLSPublicKey&>(obj.pubKeyOperator), (obj.nVersion == LEGACY_BLS_VERSION)),
|
2021-05-27 17:17:29 +02:00
|
|
|
obj.keyIDVoting,
|
|
|
|
obj.scriptPayout,
|
|
|
|
obj.inputsHash
|
2022-12-30 06:45:31 +01:00
|
|
|
);
|
2018-03-19 08:44:00 +01:00
|
|
|
if (!(s.GetType() & SER_GETHASH)) {
|
2022-12-30 06:45:31 +01:00
|
|
|
READWRITE(
|
|
|
|
obj.vchSig
|
|
|
|
);
|
2018-03-19 08:44:00 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string ToString() const;
|
2019-06-11 13:42:17 +02:00
|
|
|
|
|
|
|
void ToJson(UniValue& obj) const
|
|
|
|
{
|
|
|
|
obj.clear();
|
|
|
|
obj.setObject();
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("version", nVersion);
|
|
|
|
obj.pushKV("proTxHash", proTxHash.ToString());
|
2019-05-09 18:04:52 +02:00
|
|
|
obj.pushKV("votingAddress", EncodeDestination(PKHash(keyIDVoting)));
|
2019-06-11 13:42:17 +02:00
|
|
|
CTxDestination dest;
|
|
|
|
if (ExtractDestination(scriptPayout, dest)) {
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("payoutAddress", EncodeDestination(dest));
|
2019-06-11 13:42:17 +02:00
|
|
|
}
|
2022-12-30 06:45:31 +01:00
|
|
|
obj.pushKV("pubKeyOperator", pubKeyOperator.ToString(nVersion == LEGACY_BLS_VERSION));
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("inputsHash", inputsHash.ToString());
|
2019-06-11 13:42:17 +02:00
|
|
|
}
|
2022-02-26 19:50:35 +01:00
|
|
|
|
2022-12-30 06:45:31 +01:00
|
|
|
maybe_error IsTriviallyValid(bool is_bls_legacy_scheme) const;
|
2018-03-19 08:44:00 +01:00
|
|
|
};
|
|
|
|
|
2018-03-19 12:29:59 +01:00
|
|
|
class CProUpRevTx
|
|
|
|
{
|
|
|
|
public:
|
2022-03-06 07:54:26 +01:00
|
|
|
static constexpr auto SPECIALTX_TYPE = TRANSACTION_PROVIDER_UPDATE_REVOKE;
|
2022-12-30 06:45:31 +01:00
|
|
|
static constexpr uint16_t LEGACY_BLS_VERSION = 1;
|
|
|
|
static constexpr uint16_t BASIC_BLS_VERSION = 2;
|
|
|
|
|
|
|
|
[[nodiscard]] static constexpr auto GetVersion(const bool is_basic_scheme_active) -> uint16_t
|
|
|
|
{
|
|
|
|
return is_basic_scheme_active ? BASIC_BLS_VERSION : LEGACY_BLS_VERSION;
|
|
|
|
}
|
2018-03-19 12:29:59 +01:00
|
|
|
|
|
|
|
// these are just informational and do not have any effect on the revocation
|
|
|
|
enum {
|
|
|
|
REASON_NOT_SPECIFIED = 0,
|
|
|
|
REASON_TERMINATION_OF_SERVICE = 1,
|
|
|
|
REASON_COMPROMISED_KEYS = 2,
|
|
|
|
REASON_CHANGE_OF_KEYS = 3,
|
|
|
|
REASON_LAST = REASON_CHANGE_OF_KEYS
|
|
|
|
};
|
|
|
|
|
2022-12-30 06:45:31 +01:00
|
|
|
uint16_t nVersion{LEGACY_BLS_VERSION}; // message version
|
2018-03-19 12:29:59 +01:00
|
|
|
uint256 proTxHash;
|
|
|
|
uint16_t nReason{REASON_NOT_SPECIFIED};
|
|
|
|
uint256 inputsHash; // replay protection
|
2018-10-21 21:45:16 +02:00
|
|
|
CBLSSignature sig;
|
2018-03-19 12:29:59 +01:00
|
|
|
|
2021-05-27 17:17:29 +02:00
|
|
|
SERIALIZE_METHODS(CProUpRevTx, obj)
|
2018-03-19 12:29:59 +01:00
|
|
|
{
|
2022-12-30 06:45:31 +01:00
|
|
|
READWRITE(
|
|
|
|
obj.nVersion
|
|
|
|
);
|
|
|
|
if (obj.nVersion == 0 || obj.nVersion > BASIC_BLS_VERSION) {
|
|
|
|
// unknown version, bail out early
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
READWRITE(
|
|
|
|
obj.proTxHash,
|
|
|
|
obj.nReason,
|
|
|
|
obj.inputsHash
|
|
|
|
);
|
2018-03-19 12:29:59 +01:00
|
|
|
if (!(s.GetType() & SER_GETHASH)) {
|
2022-12-30 06:45:31 +01:00
|
|
|
READWRITE(
|
|
|
|
CBLSSignatureVersionWrapper(const_cast<CBLSSignature&>(obj.sig), (obj.nVersion == LEGACY_BLS_VERSION), true)
|
|
|
|
);
|
2018-03-19 12:29:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string ToString() const;
|
2019-06-11 13:42:17 +02:00
|
|
|
|
|
|
|
void ToJson(UniValue& obj) const
|
|
|
|
{
|
|
|
|
obj.clear();
|
|
|
|
obj.setObject();
|
2020-06-18 11:17:23 +02:00
|
|
|
obj.pushKV("version", nVersion);
|
|
|
|
obj.pushKV("proTxHash", proTxHash.ToString());
|
|
|
|
obj.pushKV("reason", (int)nReason);
|
|
|
|
obj.pushKV("inputsHash", inputsHash.ToString());
|
2019-06-11 13:42:17 +02:00
|
|
|
}
|
2022-02-26 19:50:35 +01:00
|
|
|
|
2022-12-30 06:45:31 +01:00
|
|
|
maybe_error IsTriviallyValid(bool is_bls_legacy_scheme) const;
|
2018-03-19 12:29:59 +01:00
|
|
|
};
|
|
|
|
|
2022-02-26 19:50:35 +01:00
|
|
|
template <typename ProTx>
|
|
|
|
static maybe_error CheckInputsHash(const CTransaction& tx, const ProTx& proTx)
|
|
|
|
{
|
|
|
|
if (uint256 inputsHash = CalcTxInputsHash(tx); inputsHash != proTx.inputsHash) {
|
2019-10-30 15:27:22 +01:00
|
|
|
return {TxValidationResult::TX_CONSENSUS, "bad-protx-inputs-hash"};
|
2022-02-26 19:50:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return {};
|
|
|
|
}
|
2018-03-19 08:44:00 +01:00
|
|
|
|
2018-02-13 13:36:36 +01:00
|
|
|
|
2018-04-02 00:30:17 +02:00
|
|
|
#endif // BITCOIN_EVO_PROVIDERTX_H
|