Bitcoin Core  24.99.0
P2P Digital Currency
script_p2sh_tests.cpp
Go to the documentation of this file.
1 // Copyright (c) 2012-2021 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #include <consensus/tx_verify.h>
6 #include <key.h>
7 #include <policy/policy.h>
8 #include <policy/settings.h>
9 #include <script/script.h>
10 #include <script/script_error.h>
11 #include <script/sign.h>
12 #include <script/signingprovider.h>
13 #include <test/util/setup_common.h>
14 #include <validation.h>
15 
16 #include <vector>
17 
18 #include <boost/test/unit_test.hpp>
19 
20 // Helpers:
21 static bool IsStandardTx(const CTransaction& tx, std::string& reason)
22 {
23  return IsStandardTx(tx, std::nullopt, DEFAULT_PERMIT_BAREMULTISIG, CFeeRate{DUST_RELAY_TX_FEE}, reason);
24 }
25 
26 static std::vector<unsigned char> Serialize(const CScript& s)
27 {
28  std::vector<unsigned char> sSerialized(s.begin(), s.end());
29  return sSerialized;
30 }
31 
32 static bool Verify(const CScript& scriptSig, const CScript& scriptPubKey, bool fStrict, ScriptError& err)
33 {
34  // Create dummy to/from transactions:
35  CMutableTransaction txFrom;
36  txFrom.vout.resize(1);
37  txFrom.vout[0].scriptPubKey = scriptPubKey;
38 
40  txTo.vin.resize(1);
41  txTo.vout.resize(1);
42  txTo.vin[0].prevout.n = 0;
43  txTo.vin[0].prevout.hash = txFrom.GetHash();
44  txTo.vin[0].scriptSig = scriptSig;
45  txTo.vout[0].nValue = 1;
46 
47  return VerifyScript(scriptSig, scriptPubKey, nullptr, fStrict ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE, MutableTransactionSignatureChecker(&txTo, 0, txFrom.vout[0].nValue, MissingDataBehavior::ASSERT_FAIL), &err);
48 }
49 
50 
51 BOOST_FIXTURE_TEST_SUITE(script_p2sh_tests, BasicTestingSetup)
52 
54 {
55  // Pay-to-script-hash looks like this:
56  // scriptSig: <sig> <sig...> <serialized_script>
57  // scriptPubKey: HASH160 <hash> EQUAL
58 
59  // Test SignSignature() (and therefore the version of Solver() that signs transactions)
60  FillableSigningProvider keystore;
61  CKey key[4];
62  for (int i = 0; i < 4; i++)
63  {
64  key[i].MakeNewKey(true);
65  BOOST_CHECK(keystore.AddKey(key[i]));
66  }
67 
68  // 8 Scripts: checking all combinations of
69  // different keys, straight/P2SH, pubkey/pubkeyhash
70  CScript standardScripts[4];
71  standardScripts[0] << ToByteVector(key[0].GetPubKey()) << OP_CHECKSIG;
72  standardScripts[1] = GetScriptForDestination(PKHash(key[1].GetPubKey()));
73  standardScripts[2] << ToByteVector(key[1].GetPubKey()) << OP_CHECKSIG;
74  standardScripts[3] = GetScriptForDestination(PKHash(key[2].GetPubKey()));
75  CScript evalScripts[4];
76  for (int i = 0; i < 4; i++)
77  {
78  BOOST_CHECK(keystore.AddCScript(standardScripts[i]));
79  evalScripts[i] = GetScriptForDestination(ScriptHash(standardScripts[i]));
80  }
81 
82  CMutableTransaction txFrom; // Funding transaction:
83  std::string reason;
84  txFrom.vout.resize(8);
85  for (int i = 0; i < 4; i++)
86  {
87  txFrom.vout[i].scriptPubKey = evalScripts[i];
88  txFrom.vout[i].nValue = COIN;
89  txFrom.vout[i+4].scriptPubKey = standardScripts[i];
90  txFrom.vout[i+4].nValue = COIN;
91  }
92  BOOST_CHECK(IsStandardTx(CTransaction(txFrom), reason));
93 
94  CMutableTransaction txTo[8]; // Spending transactions
95  for (int i = 0; i < 8; i++)
96  {
97  txTo[i].vin.resize(1);
98  txTo[i].vout.resize(1);
99  txTo[i].vin[0].prevout.n = i;
100  txTo[i].vin[0].prevout.hash = txFrom.GetHash();
101  txTo[i].vout[0].nValue = 1;
102  }
103  for (int i = 0; i < 8; i++)
104  {
105  BOOST_CHECK_MESSAGE(SignSignature(keystore, CTransaction(txFrom), txTo[i], 0, SIGHASH_ALL), strprintf("SignSignature %d", i));
106  }
107  // All of the above should be OK, and the txTos have valid signatures
108  // Check to make sure signature verification fails if we use the wrong ScriptSig:
109  for (int i = 0; i < 8; i++) {
110  PrecomputedTransactionData txdata(txTo[i]);
111  for (int j = 0; j < 8; j++)
112  {
113  CScript sigSave = txTo[i].vin[0].scriptSig;
114  txTo[i].vin[0].scriptSig = txTo[j].vin[0].scriptSig;
115  bool sigOK = CScriptCheck(txFrom.vout[txTo[i].vin[0].prevout.n], CTransaction(txTo[i]), 0, SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_STRICTENC, false, &txdata)();
116  if (i == j)
117  BOOST_CHECK_MESSAGE(sigOK, strprintf("VerifySignature %d %d", i, j));
118  else
119  BOOST_CHECK_MESSAGE(!sigOK, strprintf("VerifySignature %d %d", i, j));
120  txTo[i].vin[0].scriptSig = sigSave;
121  }
122  }
123 }
124 
126 {
127  ScriptError err;
128  // Make sure only the outer pay-to-script-hash does the
129  // extra-validation thing:
130  CScript invalidAsScript;
131  invalidAsScript << OP_INVALIDOPCODE << OP_INVALIDOPCODE;
132 
133  CScript p2sh = GetScriptForDestination(ScriptHash(invalidAsScript));
134 
135  CScript scriptSig;
136  scriptSig << Serialize(invalidAsScript);
137 
138  // Should not verify, because it will try to execute OP_INVALIDOPCODE
139  BOOST_CHECK(!Verify(scriptSig, p2sh, true, err));
140  BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_BAD_OPCODE, ScriptErrorString(err));
141 
142  // Try to recur, and verification should succeed because
143  // the inner HASH160 <> EQUAL should only check the hash:
145  CScript scriptSig2;
146  scriptSig2 << Serialize(invalidAsScript) << Serialize(p2sh);
147 
148  BOOST_CHECK(Verify(scriptSig2, p2sh2, true, err));
149  BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
150 }
151 
153 {
154  // Test the CScript::Set* methods
155  FillableSigningProvider keystore;
156  CKey key[4];
157  std::vector<CPubKey> keys;
158  for (int i = 0; i < 4; i++)
159  {
160  key[i].MakeNewKey(true);
161  BOOST_CHECK(keystore.AddKey(key[i]));
162  keys.push_back(key[i].GetPubKey());
163  }
164 
165  CScript inner[4];
166  inner[0] = GetScriptForDestination(PKHash(key[0].GetPubKey()));
167  inner[1] = GetScriptForMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+2));
168  inner[2] = GetScriptForMultisig(1, std::vector<CPubKey>(keys.begin(), keys.begin()+2));
169  inner[3] = GetScriptForMultisig(2, std::vector<CPubKey>(keys.begin(), keys.begin()+3));
170 
171  CScript outer[4];
172  for (int i = 0; i < 4; i++)
173  {
174  outer[i] = GetScriptForDestination(ScriptHash(inner[i]));
175  BOOST_CHECK(keystore.AddCScript(inner[i]));
176  }
177 
178  CMutableTransaction txFrom; // Funding transaction:
179  std::string reason;
180  txFrom.vout.resize(4);
181  for (int i = 0; i < 4; i++)
182  {
183  txFrom.vout[i].scriptPubKey = outer[i];
184  txFrom.vout[i].nValue = CENT;
185  }
186  BOOST_CHECK(IsStandardTx(CTransaction(txFrom), reason));
187 
188  CMutableTransaction txTo[4]; // Spending transactions
189  for (int i = 0; i < 4; i++)
190  {
191  txTo[i].vin.resize(1);
192  txTo[i].vout.resize(1);
193  txTo[i].vin[0].prevout.n = i;
194  txTo[i].vin[0].prevout.hash = txFrom.GetHash();
195  txTo[i].vout[0].nValue = 1*CENT;
196  txTo[i].vout[0].scriptPubKey = inner[i];
197  }
198  for (int i = 0; i < 4; i++)
199  {
200  BOOST_CHECK_MESSAGE(SignSignature(keystore, CTransaction(txFrom), txTo[i], 0, SIGHASH_ALL), strprintf("SignSignature %d", i));
201  BOOST_CHECK_MESSAGE(IsStandardTx(CTransaction(txTo[i]), reason), strprintf("txTo[%d].IsStandard", i));
202  }
203 }
204 
206 {
207  // Test CScript::IsPayToScriptHash()
208  uint160 dummy;
209  CScript p2sh;
210  p2sh << OP_HASH160 << ToByteVector(dummy) << OP_EQUAL;
212 
213  std::vector<unsigned char> direct = {OP_HASH160, 20};
214  direct.insert(direct.end(), 20, 0);
215  direct.push_back(OP_EQUAL);
216  BOOST_CHECK(CScript(direct.begin(), direct.end()).IsPayToScriptHash());
217 
218  // Not considered pay-to-script-hash if using one of the OP_PUSHDATA opcodes:
219  std::vector<unsigned char> pushdata1 = {OP_HASH160, OP_PUSHDATA1, 20};
220  pushdata1.insert(pushdata1.end(), 20, 0);
221  pushdata1.push_back(OP_EQUAL);
222  BOOST_CHECK(!CScript(pushdata1.begin(), pushdata1.end()).IsPayToScriptHash());
223  std::vector<unsigned char> pushdata2 = {OP_HASH160, OP_PUSHDATA2, 20, 0};
224  pushdata2.insert(pushdata2.end(), 20, 0);
225  pushdata2.push_back(OP_EQUAL);
226  BOOST_CHECK(!CScript(pushdata2.begin(), pushdata2.end()).IsPayToScriptHash());
227  std::vector<unsigned char> pushdata4 = {OP_HASH160, OP_PUSHDATA4, 20, 0, 0, 0};
228  pushdata4.insert(pushdata4.end(), 20, 0);
229  pushdata4.push_back(OP_EQUAL);
230  BOOST_CHECK(!CScript(pushdata4.begin(), pushdata4.end()).IsPayToScriptHash());
231 
232  CScript not_p2sh;
233  BOOST_CHECK(!not_p2sh.IsPayToScriptHash());
234 
235  not_p2sh.clear(); not_p2sh << OP_HASH160 << ToByteVector(dummy) << ToByteVector(dummy) << OP_EQUAL;
236  BOOST_CHECK(!not_p2sh.IsPayToScriptHash());
237 
238  not_p2sh.clear(); not_p2sh << OP_NOP << ToByteVector(dummy) << OP_EQUAL;
239  BOOST_CHECK(!not_p2sh.IsPayToScriptHash());
240 
241  not_p2sh.clear(); not_p2sh << OP_HASH160 << ToByteVector(dummy) << OP_CHECKSIG;
242  BOOST_CHECK(!not_p2sh.IsPayToScriptHash());
243 }
244 
246 {
247  // Test switch over code
248  CScript notValid;
249  ScriptError err;
250  notValid << OP_11 << OP_12 << OP_EQUALVERIFY;
251  CScript scriptSig;
252  scriptSig << Serialize(notValid);
253 
254  CScript fund = GetScriptForDestination(ScriptHash(notValid));
255 
256 
257  // Validation should succeed under old rules (hash is correct):
258  BOOST_CHECK(Verify(scriptSig, fund, false, err));
259  BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_OK, ScriptErrorString(err));
260  // Fail under new:
261  BOOST_CHECK(!Verify(scriptSig, fund, true, err));
262  BOOST_CHECK_MESSAGE(err == SCRIPT_ERR_EQUALVERIFY, ScriptErrorString(err));
263 }
264 
266 {
267  CCoinsView coinsDummy;
268  CCoinsViewCache coins(&coinsDummy);
269  FillableSigningProvider keystore;
270  CKey key[6];
271  std::vector<CPubKey> keys;
272  for (int i = 0; i < 6; i++)
273  {
274  key[i].MakeNewKey(true);
275  BOOST_CHECK(keystore.AddKey(key[i]));
276  }
277  for (int i = 0; i < 3; i++)
278  keys.push_back(key[i].GetPubKey());
279 
280  CMutableTransaction txFrom;
281  txFrom.vout.resize(7);
282 
283  // First three are standard:
285  BOOST_CHECK(keystore.AddCScript(pay1));
286  CScript pay1of3 = GetScriptForMultisig(1, keys);
287 
288  txFrom.vout[0].scriptPubKey = GetScriptForDestination(ScriptHash(pay1)); // P2SH (OP_CHECKSIG)
289  txFrom.vout[0].nValue = 1000;
290  txFrom.vout[1].scriptPubKey = pay1; // ordinary OP_CHECKSIG
291  txFrom.vout[1].nValue = 2000;
292  txFrom.vout[2].scriptPubKey = pay1of3; // ordinary OP_CHECKMULTISIG
293  txFrom.vout[2].nValue = 3000;
294 
295  // vout[3] is complicated 1-of-3 AND 2-of-3
296  // ... that is OK if wrapped in P2SH:
297  CScript oneAndTwo;
298  oneAndTwo << OP_1 << ToByteVector(key[0].GetPubKey()) << ToByteVector(key[1].GetPubKey()) << ToByteVector(key[2].GetPubKey());
299  oneAndTwo << OP_3 << OP_CHECKMULTISIGVERIFY;
300  oneAndTwo << OP_2 << ToByteVector(key[3].GetPubKey()) << ToByteVector(key[4].GetPubKey()) << ToByteVector(key[5].GetPubKey());
301  oneAndTwo << OP_3 << OP_CHECKMULTISIG;
302  BOOST_CHECK(keystore.AddCScript(oneAndTwo));
303  txFrom.vout[3].scriptPubKey = GetScriptForDestination(ScriptHash(oneAndTwo));
304  txFrom.vout[3].nValue = 4000;
305 
306  // vout[4] is max sigops:
307  CScript fifteenSigops; fifteenSigops << OP_1;
308  for (unsigned i = 0; i < MAX_P2SH_SIGOPS; i++)
309  fifteenSigops << ToByteVector(key[i%3].GetPubKey());
310  fifteenSigops << OP_15 << OP_CHECKMULTISIG;
311  BOOST_CHECK(keystore.AddCScript(fifteenSigops));
312  txFrom.vout[4].scriptPubKey = GetScriptForDestination(ScriptHash(fifteenSigops));
313  txFrom.vout[4].nValue = 5000;
314 
315  // vout[5/6] are non-standard because they exceed MAX_P2SH_SIGOPS
316  CScript sixteenSigops; sixteenSigops << OP_16 << OP_CHECKMULTISIG;
317  BOOST_CHECK(keystore.AddCScript(sixteenSigops));
318  txFrom.vout[5].scriptPubKey = GetScriptForDestination(ScriptHash(sixteenSigops));
319  txFrom.vout[5].nValue = 5000;
320  CScript twentySigops; twentySigops << OP_CHECKMULTISIG;
321  BOOST_CHECK(keystore.AddCScript(twentySigops));
322  txFrom.vout[6].scriptPubKey = GetScriptForDestination(ScriptHash(twentySigops));
323  txFrom.vout[6].nValue = 6000;
324 
325  AddCoins(coins, CTransaction(txFrom), 0);
326 
327  CMutableTransaction txTo;
328  txTo.vout.resize(1);
329  txTo.vout[0].scriptPubKey = GetScriptForDestination(PKHash(key[1].GetPubKey()));
330 
331  txTo.vin.resize(5);
332  for (int i = 0; i < 5; i++)
333  {
334  txTo.vin[i].prevout.n = i;
335  txTo.vin[i].prevout.hash = txFrom.GetHash();
336  }
337  BOOST_CHECK(SignSignature(keystore, CTransaction(txFrom), txTo, 0, SIGHASH_ALL));
338  BOOST_CHECK(SignSignature(keystore, CTransaction(txFrom), txTo, 1, SIGHASH_ALL));
339  BOOST_CHECK(SignSignature(keystore, CTransaction(txFrom), txTo, 2, SIGHASH_ALL));
340  // SignSignature doesn't know how to sign these. We're
341  // not testing validating signatures, so just create
342  // dummy signatures that DO include the correct P2SH scripts:
343  txTo.vin[3].scriptSig << OP_11 << OP_11 << std::vector<unsigned char>(oneAndTwo.begin(), oneAndTwo.end());
344  txTo.vin[4].scriptSig << std::vector<unsigned char>(fifteenSigops.begin(), fifteenSigops.end());
345 
346  BOOST_CHECK(::AreInputsStandard(CTransaction(txTo), coins));
347  // 22 P2SH sigops for all inputs (1 for vin[0], 6 for vin[3], 15 for vin[4]
349 
350  CMutableTransaction txToNonStd1;
351  txToNonStd1.vout.resize(1);
352  txToNonStd1.vout[0].scriptPubKey = GetScriptForDestination(PKHash(key[1].GetPubKey()));
353  txToNonStd1.vout[0].nValue = 1000;
354  txToNonStd1.vin.resize(1);
355  txToNonStd1.vin[0].prevout.n = 5;
356  txToNonStd1.vin[0].prevout.hash = txFrom.GetHash();
357  txToNonStd1.vin[0].scriptSig << std::vector<unsigned char>(sixteenSigops.begin(), sixteenSigops.end());
358 
359  BOOST_CHECK(!::AreInputsStandard(CTransaction(txToNonStd1), coins));
360  BOOST_CHECK_EQUAL(GetP2SHSigOpCount(CTransaction(txToNonStd1), coins), 16U);
361 
362  CMutableTransaction txToNonStd2;
363  txToNonStd2.vout.resize(1);
364  txToNonStd2.vout[0].scriptPubKey = GetScriptForDestination(PKHash(key[1].GetPubKey()));
365  txToNonStd2.vout[0].nValue = 1000;
366  txToNonStd2.vin.resize(1);
367  txToNonStd2.vin[0].prevout.n = 6;
368  txToNonStd2.vin[0].prevout.hash = txFrom.GetHash();
369  txToNonStd2.vin[0].scriptSig << std::vector<unsigned char>(twentySigops.begin(), twentySigops.end());
370 
371  BOOST_CHECK(!::AreInputsStandard(CTransaction(txToNonStd2), coins));
372  BOOST_CHECK_EQUAL(GetP2SHSigOpCount(CTransaction(txToNonStd2), coins), 20U);
373 }
374 
static constexpr CAmount COIN
The amount of satoshis in one BTC.
Definition: amount.h:15
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:213
Abstract view on the open txout dataset.
Definition: coins.h:157
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
Definition: feerate.h:33
An encapsulated private key.
Definition: key.h:27
void MakeNewKey(bool fCompressed)
Generate a new private key using a cryptographic PRNG.
Definition: key.cpp:160
CPubKey GetPubKey() const
Compute the public key from a private key.
Definition: key.cpp:187
Closure representing one script verification Note that this stores references to the spending transac...
Definition: validation.h:294
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:411
bool IsPayToScriptHash() const
Definition: script.cpp:201
void clear()
Definition: script.h:554
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:288
Fillable signing provider that keeps keys in an address->secret map.
virtual bool AddCScript(const CScript &redeemScript)
virtual bool AddKey(const CKey &key)
iterator begin()
Definition: prevector.h:292
iterator end()
Definition: prevector.h:294
160-bit opaque blob.
Definition: uint256.h:108
void AddCoins(CCoinsViewCache &cache, const CTransaction &tx, int nHeight, bool check_for_overwrite)
Utility function to add all of a transaction's outputs to a cache.
Definition: coins.cpp:115
BOOST_AUTO_TEST_SUITE_END()
bool VerifyScript(const CScript &scriptSig, const CScript &scriptPubKey, const CScriptWitness *witness, unsigned int flags, const BaseSignatureChecker &checker, ScriptError *serror)
@ SCRIPT_VERIFY_P2SH
Definition: interpreter.h:47
@ SCRIPT_VERIFY_STRICTENC
Definition: interpreter.h:52
@ SCRIPT_VERIFY_NONE
Definition: interpreter.h:44
GenericTransactionSignatureChecker< CMutableTransaction > MutableTransactionSignatureChecker
Definition: interpreter.h:305
@ SIGHASH_ALL
Definition: interpreter.h:28
@ ASSERT_FAIL
Abort execution through assertion failure (for consensus code)
#define BOOST_CHECK_EQUAL(v1, v2)
Definition: object.cpp:17
#define BOOST_CHECK(expr)
Definition: object.cpp:16
bool AreInputsStandard(const CTransaction &tx, const CCoinsViewCache &mapInputs)
Check transaction inputs to mitigate two potential denial-of-service attacks:
Definition: policy.cpp:177
static constexpr bool DEFAULT_PERMIT_BAREMULTISIG
Default for -permitbaremultisig.
Definition: policy.h:39
static constexpr unsigned int DUST_RELAY_TX_FEE
Min feerate for defining dust.
Definition: policy.h:55
static constexpr unsigned int MAX_P2SH_SIGOPS
Maximum number of signature check operations in an IsStandard() P2SH script.
Definition: policy.h:31
std::vector< unsigned char > ToByteVector(const T &in)
Definition: script.h:63
@ OP_2
Definition: script.h:81
@ OP_PUSHDATA4
Definition: script.h:76
@ OP_CHECKMULTISIG
Definition: script.h:188
@ OP_CHECKSIG
Definition: script.h:186
@ OP_16
Definition: script.h:95
@ OP_INVALIDOPCODE
Definition: script.h:208
@ OP_EQUAL
Definition: script.h:142
@ OP_NOP
Definition: script.h:98
@ OP_HASH160
Definition: script.h:183
@ OP_1
Definition: script.h:79
@ OP_12
Definition: script.h:91
@ OP_CHECKMULTISIGVERIFY
Definition: script.h:189
@ OP_15
Definition: script.h:94
@ OP_PUSHDATA1
Definition: script.h:74
@ OP_3
Definition: script.h:82
@ OP_11
Definition: script.h:90
@ OP_PUSHDATA2
Definition: script.h:75
@ OP_EQUALVERIFY
Definition: script.h:143
std::string ScriptErrorString(const ScriptError serror)
enum ScriptError_t ScriptError
@ SCRIPT_ERR_EQUALVERIFY
Definition: script_error.h:28
@ SCRIPT_ERR_OK
Definition: script_error.h:13
@ SCRIPT_ERR_BAD_OPCODE
Definition: script_error.h:34
static bool Verify(const CScript &scriptSig, const CScript &scriptPubKey, bool fStrict, ScriptError &err)
static std::vector< unsigned char > Serialize(const CScript &s)
BOOST_AUTO_TEST_CASE(sign)
static bool IsStandardTx(const CTransaction &tx, std::string &reason)
static constexpr CAmount CENT
Definition: setup_common.h:78
bool SignSignature(const SigningProvider &provider, const CScript &fromPubKey, CMutableTransaction &txTo, unsigned int nIn, const CAmount &amount, int nHashType)
Produce a script signature for a transaction.
Definition: sign.cpp:568
static bool GetPubKey(const SigningProvider &provider, const SignatureData &sigdata, const CKeyID &address, CPubKey &pubkey)
Definition: sign.cpp:107
CScript GetScriptForMultisig(int nRequired, const std::vector< CPubKey > &keys)
Generate a multisig script.
Definition: standard.cpp:344
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
Definition: standard.cpp:334
Basic testing setup.
Definition: setup_common.h:83
A mutable version of CTransaction.
Definition: transaction.h:373
uint256 GetHash() const
Compute the hash of this CMutableTransaction.
Definition: transaction.cpp:68
std::vector< CTxOut > vout
Definition: transaction.h:375
std::vector< CTxIn > vin
Definition: transaction.h:374
#define strprintf
Format arguments and return the string or write to given std::ostream (see tinyformat::format doc for...
Definition: tinyformat.h:1164
unsigned int GetP2SHSigOpCount(const CTransaction &tx, const CCoinsViewCache &inputs)
Count ECDSA signature operations in pay-to-script-hash inputs.
Definition: tx_verify.cpp:130