aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Chow <github@achow101.com>2023-08-08 10:39:01 -0400
committerAndrew Chow <github@achow101.com>2023-08-14 17:38:27 -0400
commit86ea8bed5473f400f7a93fcc455393a574a2f319 (patch)
treee395a5ecbfd4faa78b80a39dcdf10d06fd733eea
parentb81ebff0d99c45c071b999796b8ae3f0f2517b22 (diff)
downloadbitcoin-86ea8bed5473f400f7a93fcc455393a574a2f319.tar.xz
Move CScriptID to script.{h/cpp}
CScriptID should be next to CScript just as CKeyID is next to CPubKey
-rw-r--r--src/compressor.cpp1
-rw-r--r--src/interfaces/wallet.h1
-rw-r--r--src/script/script.cpp3
-rw-r--r--src/script/script.h11
-rw-r--r--src/script/sign.cpp1
-rw-r--r--src/script/standard.cpp2
-rw-r--r--src/script/standard.h9
-rw-r--r--src/test/compress_tests.cpp1
-rw-r--r--src/test/fuzz/integer.cpp1
-rw-r--r--src/wallet/rpc/addresses.cpp1
-rw-r--r--src/wallet/rpc/coins.cpp1
-rw-r--r--src/wallet/rpc/spend.cpp1
-rw-r--r--src/wallet/scriptpubkeyman.cpp1
-rw-r--r--src/wallet/scriptpubkeyman.h1
-rw-r--r--src/wallet/spend.cpp1
-rw-r--r--src/wallet/walletdb.cpp1
16 files changed, 26 insertions, 11 deletions
diff --git a/src/compressor.cpp b/src/compressor.cpp
index 32af8eab49..2dbd586bfa 100644
--- a/src/compressor.cpp
+++ b/src/compressor.cpp
@@ -6,6 +6,7 @@
#include <compressor.h>
#include <pubkey.h>
+#include <script/script.h>
#include <script/standard.h>
/*
diff --git a/src/interfaces/wallet.h b/src/interfaces/wallet.h
index 8c31112fc9..9d8bebb406 100644
--- a/src/interfaces/wallet.h
+++ b/src/interfaces/wallet.h
@@ -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>
diff --git a/src/script/script.cpp b/src/script/script.cpp
index 79d19b9085..1594d3cc79 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -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)
diff --git a/src/script/script.h b/src/script/script.h
index 374ae1642e..902f756afc 100644
--- a/src/script/script.h
+++ b/src/script/script.h
@@ -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);
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index 85589fe86b..c28773ed0e 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -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>
diff --git a/src/script/standard.cpp b/src/script/standard.cpp
index e13784e0fc..6f5145a74b 100644
--- a/src/script/standard.cpp
+++ b/src/script/standard.cpp
@@ -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)) {}
diff --git a/src/script/standard.h b/src/script/standard.h
index 3e60ea453d..8a76606082 100644
--- a/src/script/standard.h
+++ b/src/script/standard.h
@@ -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.
diff --git a/src/test/compress_tests.cpp b/src/test/compress_tests.cpp
index de99b91c7f..bf9aba1868 100644
--- a/src/test/compress_tests.cpp
+++ b/src/test/compress_tests.cpp
@@ -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>
diff --git a/src/test/fuzz/integer.cpp b/src/test/fuzz/integer.cpp
index 91521bc7f4..54f968c53c 100644
--- a/src/test/fuzz/integer.cpp
+++ b/src/test/fuzz/integer.cpp
@@ -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>
diff --git a/src/wallet/rpc/addresses.cpp b/src/wallet/rpc/addresses.cpp
index 06f396a6d7..dbd5c60511 100644
--- a/src/wallet/rpc/addresses.cpp
+++ b/src/wallet/rpc/addresses.cpp
@@ -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>
diff --git a/src/wallet/rpc/coins.cpp b/src/wallet/rpc/coins.cpp
index 521378e188..6f0623cdf5 100644
--- a/src/wallet/rpc/coins.cpp
+++ b/src/wallet/rpc/coins.cpp
@@ -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>
diff --git a/src/wallet/rpc/spend.cpp b/src/wallet/rpc/spend.cpp
index b695d4bed3..0e3f10dc76 100644
--- a/src/wallet/rpc/spend.cpp
+++ b/src/wallet/rpc/spend.cpp
@@ -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>
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp
index 5b110b4d14..284bd531be 100644
--- a/src/wallet/scriptpubkeyman.cpp
+++ b/src/wallet/scriptpubkeyman.cpp
@@ -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>
diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h
index bf35c776ae..00159abbef 100644
--- a/src/wallet/scriptpubkeyman.h
+++ b/src/wallet/scriptpubkeyman.h
@@ -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>
diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp
index a3728223fb..9358bbeebe 100644
--- a/src/wallet/spend.cpp
+++ b/src/wallet/spend.cpp
@@ -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>
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index 8212c04464..92eca46f05 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -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>