Move CScriptID to script.{h/cpp}

CScriptID should be next to CScript just as CKeyID is next to CPubKey
This commit is contained in:
Andrew Chow 2023-08-08 10:39:01 -04:00
parent b81ebff0d9
commit 86ea8bed54
16 changed files with 26 additions and 11 deletions

View file

@ -6,6 +6,7 @@
#include <compressor.h>
#include <pubkey.h>
#include <script/script.h>
#include <script/standard.h>
/*

View file

@ -8,6 +8,7 @@
#include <consensus/amount.h>
#include <interfaces/chain.h> // For ChainClient
#include <pubkey.h> // For CKeyID and CScriptID (definitions needed in CTxDestination instantiation)
#include <script/script.h>
#include <script/standard.h> // For CTxDestination
#include <support/allocators/secure.h> // For SecureString
#include <util/fs.h>

View file

@ -5,10 +5,13 @@
#include <script/script.h>
#include <hash.h>
#include <util/strencodings.h>
#include <string>
CScriptID::CScriptID(const CScript& in) : BaseHash(Hash160(in)) {}
std::string GetOpName(opcodetype opcode)
{
switch (opcode)

View file

@ -10,6 +10,8 @@
#include <crypto/common.h>
#include <prevector.h>
#include <serialize.h>
#include <uint256.h>
#include <util/hash_type.h>
#include <assert.h>
#include <climits>
@ -575,6 +577,15 @@ struct CScriptWitness
std::string ToString() const;
};
/** A reference to a CScript: the Hash160 of its serialization */
class CScriptID : public BaseHash<uint160>
{
public:
CScriptID() : BaseHash() {}
explicit CScriptID(const CScript& in);
explicit CScriptID(const uint160& in) : BaseHash(in) {}
};
/** Test for OP_SUCCESSx opcodes as defined by BIP342. */
bool IsOpSuccess(const opcodetype& opcode);

View file

@ -11,6 +11,7 @@
#include <primitives/transaction.h>
#include <script/keyorigin.h>
#include <script/miniscript.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <script/standard.h>
#include <uint256.h>

View file

@ -16,8 +16,6 @@
typedef std::vector<unsigned char> valtype;
CScriptID::CScriptID(const CScript& in) : BaseHash(Hash160(in)) {}
ScriptHash::ScriptHash(const CScript& in) : BaseHash(Hash160(in)) {}
ScriptHash::ScriptHash(const CScriptID& in) : BaseHash(static_cast<uint160>(in)) {}

View file

@ -21,15 +21,6 @@ static const bool DEFAULT_ACCEPT_DATACARRIER = true;
class CKeyID;
class CScript;
/** A reference to a CScript: the Hash160 of its serialization (see script.h) */
class CScriptID : public BaseHash<uint160>
{
public:
CScriptID() : BaseHash() {}
explicit CScriptID(const CScript& in);
explicit CScriptID(const uint160& in) : BaseHash(in) {}
};
/**
* Default setting for -datacarriersize. 80 bytes of data, +1 for OP_RETURN,
* +2 for the pushdata opcodes.

View file

@ -3,6 +3,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <compressor.h>
#include <script/script.h>
#include <script/standard.h>
#include <test/util/setup_common.h>

View file

@ -19,6 +19,7 @@
#include <pow.h>
#include <protocol.h>
#include <pubkey.h>
#include <script/script.h>
#include <script/standard.h>
#include <serialize.h>
#include <streams.h>

View file

@ -5,6 +5,7 @@
#include <core_io.h>
#include <key_io.h>
#include <rpc/util.h>
#include <script/script.h>
#include <util/bip32.h>
#include <util/translation.h>
#include <wallet/receive.h>

View file

@ -6,6 +6,7 @@
#include <hash.h>
#include <key_io.h>
#include <rpc/util.h>
#include <script/script.h>
#include <util/moneystr.h>
#include <wallet/coincontrol.h>
#include <wallet/receive.h>

View file

@ -8,6 +8,7 @@
#include <policy/policy.h>
#include <rpc/rawtransaction_util.h>
#include <rpc/util.h>
#include <script/script.h>
#include <util/fees.h>
#include <util/rbf.h>
#include <util/translation.h>

View file

@ -7,6 +7,7 @@
#include <logging.h>
#include <outputtype.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/sign.h>
#include <util/bip32.h>
#include <util/strencodings.h>

View file

@ -8,6 +8,7 @@
#include <logging.h>
#include <psbt.h>
#include <script/descriptor.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <script/standard.h>
#include <util/error.h>

View file

@ -11,6 +11,7 @@
#include <numeric>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <script/signingprovider.h>
#include <util/check.h>
#include <util/fees.h>

View file

@ -8,6 +8,7 @@
#include <common/system.h>
#include <key_io.h>
#include <protocol.h>
#include <script/script.h>
#include <serialize.h>
#include <sync.h>
#include <util/bip32.h>