Bitcoin Core  24.1.0
P2P Digital Currency
txvalidationcache_tests.cpp
Go to the documentation of this file.
1 // Copyright (c) 2011-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/validation.h>
6 #include <key.h>
7 #include <script/sign.h>
9 #include <script/standard.h>
10 #include <test/util/setup_common.h>
11 #include <txmempool.h>
12 #include <validation.h>
13 
14 #include <boost/test/unit_test.hpp>
15 
18  : TestChain100Setup{CBaseChainParams::REGTEST, {"-testactivationheight=dersig@102"}} {}
19 };
20 
21 bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
22  const CCoinsViewCache& inputs, unsigned int flags, bool cacheSigStore,
23  bool cacheFullScriptStore, PrecomputedTransactionData& txdata,
24  std::vector<CScriptCheck>* pvChecks) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
25 
26 BOOST_AUTO_TEST_SUITE(txvalidationcache_tests)
27 
28 BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup)
29 {
30  // Make sure skipping validation of transactions that were
31  // validated going into the memory pool does not allow
32  // double-spends in blocks to pass validation when they should not.
33 
34  CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
35 
36  const auto ToMemPool = [this](const CMutableTransaction& tx) {
37  LOCK(cs_main);
38 
39  const MempoolAcceptResult result = m_node.chainman->ProcessTransaction(MakeTransactionRef(tx));
41  };
42 
43  // Create a double-spend of mature coinbase txn:
44  std::vector<CMutableTransaction> spends;
45  spends.resize(2);
46  for (int i = 0; i < 2; i++)
47  {
48  spends[i].nVersion = 1;
49  spends[i].vin.resize(1);
50  spends[i].vin[0].prevout.hash = m_coinbase_txns[0]->GetHash();
51  spends[i].vin[0].prevout.n = 0;
52  spends[i].vout.resize(1);
53  spends[i].vout[0].nValue = 11*CENT;
54  spends[i].vout[0].scriptPubKey = scriptPubKey;
55 
56  // Sign:
57  std::vector<unsigned char> vchSig;
58  uint256 hash = SignatureHash(scriptPubKey, spends[i], 0, SIGHASH_ALL, 0, SigVersion::BASE);
59  BOOST_CHECK(coinbaseKey.Sign(hash, vchSig));
60  vchSig.push_back((unsigned char)SIGHASH_ALL);
61  spends[i].vin[0].scriptSig << vchSig;
62  }
63 
64  CBlock block;
65 
66  // Test 1: block with both of those transactions should be rejected.
67  block = CreateAndProcessBlock(spends, scriptPubKey);
68  {
69  LOCK(cs_main);
70  BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() != block.GetHash());
71  }
72 
73  // Test 2: ... and should be rejected if spend1 is in the memory pool
74  BOOST_CHECK(ToMemPool(spends[0]));
75  block = CreateAndProcessBlock(spends, scriptPubKey);
76  {
77  LOCK(cs_main);
78  BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() != block.GetHash());
79  }
80  m_node.mempool->clear();
81 
82  // Test 3: ... and should be rejected if spend2 is in the memory pool
83  BOOST_CHECK(ToMemPool(spends[1]));
84  block = CreateAndProcessBlock(spends, scriptPubKey);
85  {
86  LOCK(cs_main);
87  BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() != block.GetHash());
88  }
89  m_node.mempool->clear();
90 
91  // Final sanity test: first spend in *m_node.mempool, second in block, that's OK:
92  std::vector<CMutableTransaction> oneSpend;
93  oneSpend.push_back(spends[0]);
94  BOOST_CHECK(ToMemPool(spends[1]));
95  block = CreateAndProcessBlock(oneSpend, scriptPubKey);
96  {
97  LOCK(cs_main);
98  BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() == block.GetHash());
99  }
100  // spends[1] should have been removed from the mempool when the
101  // block with spends[0] is accepted:
102  BOOST_CHECK_EQUAL(m_node.mempool->size(), 0U);
103 }
104 
105 // Run CheckInputScripts (using CoinsTip()) on the given transaction, for all script
106 // flags. Test that CheckInputScripts passes for all flags that don't overlap with
107 // the failing_flags argument, but otherwise fails.
108 // CHECKLOCKTIMEVERIFY and CHECKSEQUENCEVERIFY (and future NOP codes that may
109 // get reassigned) have an interaction with DISCOURAGE_UPGRADABLE_NOPS: if
110 // the script flags used contain DISCOURAGE_UPGRADABLE_NOPS but don't contain
111 // CHECKLOCKTIMEVERIFY (or CHECKSEQUENCEVERIFY), but the script does contain
112 // OP_CHECKLOCKTIMEVERIFY (or OP_CHECKSEQUENCEVERIFY), then script execution
113 // should fail.
114 // Capture this interaction with the upgraded_nop argument: set it when evaluating
115 // any script flag that is implemented as an upgraded NOP code.
116 static void ValidateCheckInputsForAllFlags(const CTransaction &tx, uint32_t failing_flags, bool add_to_cache, CCoinsViewCache& active_coins_tip) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
117 {
119 
120  FastRandomContext insecure_rand(true);
121 
122  for (int count = 0; count < 10000; ++count) {
123  TxValidationState state;
124 
125  // Randomly selects flag combinations
126  uint32_t test_flags = (uint32_t) insecure_rand.randrange((SCRIPT_VERIFY_END_MARKER - 1) << 1);
127 
128  // Filter out incompatible flag choices
129  if ((test_flags & SCRIPT_VERIFY_CLEANSTACK)) {
130  // CLEANSTACK requires P2SH and WITNESS, see VerifyScript() in
131  // script/interpreter.cpp
133  }
134  if ((test_flags & SCRIPT_VERIFY_WITNESS)) {
135  // WITNESS requires P2SH
136  test_flags |= SCRIPT_VERIFY_P2SH;
137  }
138  bool ret = CheckInputScripts(tx, state, &active_coins_tip, test_flags, true, add_to_cache, txdata, nullptr);
139  // CheckInputScripts should succeed iff test_flags doesn't intersect with
140  // failing_flags
141  bool expected_return_value = !(test_flags & failing_flags);
142  BOOST_CHECK_EQUAL(ret, expected_return_value);
143 
144  // Test the caching
145  if (ret && add_to_cache) {
146  // Check that we get a cache hit if the tx was valid
147  std::vector<CScriptCheck> scriptchecks;
148  BOOST_CHECK(CheckInputScripts(tx, state, &active_coins_tip, test_flags, true, add_to_cache, txdata, &scriptchecks));
149  BOOST_CHECK(scriptchecks.empty());
150  } else {
151  // Check that we get script executions to check, if the transaction
152  // was invalid, or we didn't add to cache.
153  std::vector<CScriptCheck> scriptchecks;
154  BOOST_CHECK(CheckInputScripts(tx, state, &active_coins_tip, test_flags, true, add_to_cache, txdata, &scriptchecks));
155  BOOST_CHECK_EQUAL(scriptchecks.size(), tx.vin.size());
156  }
157  }
158 }
159 
161 {
162  // Test that passing CheckInputScripts with one set of script flags doesn't imply
163  // that we would pass again with a different set of flags.
164  CScript p2pk_scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
165  CScript p2sh_scriptPubKey = GetScriptForDestination(ScriptHash(p2pk_scriptPubKey));
166  CScript p2pkh_scriptPubKey = GetScriptForDestination(PKHash(coinbaseKey.GetPubKey()));
167  CScript p2wpkh_scriptPubKey = GetScriptForDestination(WitnessV0KeyHash(coinbaseKey.GetPubKey()));
168 
169  FillableSigningProvider keystore;
170  BOOST_CHECK(keystore.AddKey(coinbaseKey));
171  BOOST_CHECK(keystore.AddCScript(p2pk_scriptPubKey));
172 
173  // flags to test: SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY, SCRIPT_VERIFY_CHECKSEQUENCE_VERIFY, SCRIPT_VERIFY_NULLDUMMY, uncompressed pubkey thing
174 
175  // Create 2 outputs that match the three scripts above, spending the first
176  // coinbase tx.
177  CMutableTransaction spend_tx;
178 
179  spend_tx.nVersion = 1;
180  spend_tx.vin.resize(1);
181  spend_tx.vin[0].prevout.hash = m_coinbase_txns[0]->GetHash();
182  spend_tx.vin[0].prevout.n = 0;
183  spend_tx.vout.resize(4);
184  spend_tx.vout[0].nValue = 11*CENT;
185  spend_tx.vout[0].scriptPubKey = p2sh_scriptPubKey;
186  spend_tx.vout[1].nValue = 11*CENT;
187  spend_tx.vout[1].scriptPubKey = p2wpkh_scriptPubKey;
188  spend_tx.vout[2].nValue = 11*CENT;
189  spend_tx.vout[2].scriptPubKey = CScript() << OP_CHECKLOCKTIMEVERIFY << OP_DROP << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
190  spend_tx.vout[3].nValue = 11*CENT;
191  spend_tx.vout[3].scriptPubKey = CScript() << OP_CHECKSEQUENCEVERIFY << OP_DROP << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
192 
193  // Sign, with a non-DER signature
194  {
195  std::vector<unsigned char> vchSig;
196  uint256 hash = SignatureHash(p2pk_scriptPubKey, spend_tx, 0, SIGHASH_ALL, 0, SigVersion::BASE);
197  BOOST_CHECK(coinbaseKey.Sign(hash, vchSig));
198  vchSig.push_back((unsigned char) 0); // padding byte makes this non-DER
199  vchSig.push_back((unsigned char)SIGHASH_ALL);
200  spend_tx.vin[0].scriptSig << vchSig;
201  }
202 
203  // Test that invalidity under a set of flags doesn't preclude validity
204  // under other (eg consensus) flags.
205  // spend_tx is invalid according to DERSIG
206  {
207  LOCK(cs_main);
208 
209  TxValidationState state;
210  PrecomputedTransactionData ptd_spend_tx;
211 
212  BOOST_CHECK(!CheckInputScripts(CTransaction(spend_tx), state, &m_node.chainman->ActiveChainstate().CoinsTip(), SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_DERSIG, true, true, ptd_spend_tx, nullptr));
213 
214  // If we call again asking for scriptchecks (as happens in
215  // ConnectBlock), we should add a script check object for this -- we're
216  // not caching invalidity (if that changes, delete this test case).
217  std::vector<CScriptCheck> scriptchecks;
218  BOOST_CHECK(CheckInputScripts(CTransaction(spend_tx), state, &m_node.chainman->ActiveChainstate().CoinsTip(), SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_DERSIG, true, true, ptd_spend_tx, &scriptchecks));
219  BOOST_CHECK_EQUAL(scriptchecks.size(), 1U);
220 
221  // Test that CheckInputScripts returns true iff DERSIG-enforcing flags are
222  // not present. Don't add these checks to the cache, so that we can
223  // test later that block validation works fine in the absence of cached
224  // successes.
226  }
227 
228  // And if we produce a block with this tx, it should be valid (DERSIG not
229  // enabled yet), even though there's no cache entry.
230  CBlock block;
231 
232  block = CreateAndProcessBlock({spend_tx}, p2pk_scriptPubKey);
233  LOCK(cs_main);
234  BOOST_CHECK(m_node.chainman->ActiveChain().Tip()->GetBlockHash() == block.GetHash());
235  BOOST_CHECK(m_node.chainman->ActiveChainstate().CoinsTip().GetBestBlock() == block.GetHash());
236 
237  // Test P2SH: construct a transaction that is valid without P2SH, and
238  // then test validity with P2SH.
239  {
240  CMutableTransaction invalid_under_p2sh_tx;
241  invalid_under_p2sh_tx.nVersion = 1;
242  invalid_under_p2sh_tx.vin.resize(1);
243  invalid_under_p2sh_tx.vin[0].prevout.hash = spend_tx.GetHash();
244  invalid_under_p2sh_tx.vin[0].prevout.n = 0;
245  invalid_under_p2sh_tx.vout.resize(1);
246  invalid_under_p2sh_tx.vout[0].nValue = 11*CENT;
247  invalid_under_p2sh_tx.vout[0].scriptPubKey = p2pk_scriptPubKey;
248  std::vector<unsigned char> vchSig2(p2pk_scriptPubKey.begin(), p2pk_scriptPubKey.end());
249  invalid_under_p2sh_tx.vin[0].scriptSig << vchSig2;
250 
251  ValidateCheckInputsForAllFlags(CTransaction(invalid_under_p2sh_tx), SCRIPT_VERIFY_P2SH, true, m_node.chainman->ActiveChainstate().CoinsTip());
252  }
253 
254  // Test CHECKLOCKTIMEVERIFY
255  {
256  CMutableTransaction invalid_with_cltv_tx;
257  invalid_with_cltv_tx.nVersion = 1;
258  invalid_with_cltv_tx.nLockTime = 100;
259  invalid_with_cltv_tx.vin.resize(1);
260  invalid_with_cltv_tx.vin[0].prevout.hash = spend_tx.GetHash();
261  invalid_with_cltv_tx.vin[0].prevout.n = 2;
262  invalid_with_cltv_tx.vin[0].nSequence = 0;
263  invalid_with_cltv_tx.vout.resize(1);
264  invalid_with_cltv_tx.vout[0].nValue = 11*CENT;
265  invalid_with_cltv_tx.vout[0].scriptPubKey = p2pk_scriptPubKey;
266 
267  // Sign
268  std::vector<unsigned char> vchSig;
269  uint256 hash = SignatureHash(spend_tx.vout[2].scriptPubKey, invalid_with_cltv_tx, 0, SIGHASH_ALL, 0, SigVersion::BASE);
270  BOOST_CHECK(coinbaseKey.Sign(hash, vchSig));
271  vchSig.push_back((unsigned char)SIGHASH_ALL);
272  invalid_with_cltv_tx.vin[0].scriptSig = CScript() << vchSig << 101;
273 
274  ValidateCheckInputsForAllFlags(CTransaction(invalid_with_cltv_tx), SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY, true, m_node.chainman->ActiveChainstate().CoinsTip());
275 
276  // Make it valid, and check again
277  invalid_with_cltv_tx.vin[0].scriptSig = CScript() << vchSig << 100;
278  TxValidationState state;
280  BOOST_CHECK(CheckInputScripts(CTransaction(invalid_with_cltv_tx), state, m_node.chainman->ActiveChainstate().CoinsTip(), SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY, true, true, txdata, nullptr));
281  }
282 
283  // TEST CHECKSEQUENCEVERIFY
284  {
285  CMutableTransaction invalid_with_csv_tx;
286  invalid_with_csv_tx.nVersion = 2;
287  invalid_with_csv_tx.vin.resize(1);
288  invalid_with_csv_tx.vin[0].prevout.hash = spend_tx.GetHash();
289  invalid_with_csv_tx.vin[0].prevout.n = 3;
290  invalid_with_csv_tx.vin[0].nSequence = 100;
291  invalid_with_csv_tx.vout.resize(1);
292  invalid_with_csv_tx.vout[0].nValue = 11*CENT;
293  invalid_with_csv_tx.vout[0].scriptPubKey = p2pk_scriptPubKey;
294 
295  // Sign
296  std::vector<unsigned char> vchSig;
297  uint256 hash = SignatureHash(spend_tx.vout[3].scriptPubKey, invalid_with_csv_tx, 0, SIGHASH_ALL, 0, SigVersion::BASE);
298  BOOST_CHECK(coinbaseKey.Sign(hash, vchSig));
299  vchSig.push_back((unsigned char)SIGHASH_ALL);
300  invalid_with_csv_tx.vin[0].scriptSig = CScript() << vchSig << 101;
301 
302  ValidateCheckInputsForAllFlags(CTransaction(invalid_with_csv_tx), SCRIPT_VERIFY_CHECKSEQUENCEVERIFY, true, m_node.chainman->ActiveChainstate().CoinsTip());
303 
304  // Make it valid, and check again
305  invalid_with_csv_tx.vin[0].scriptSig = CScript() << vchSig << 100;
306  TxValidationState state;
308  BOOST_CHECK(CheckInputScripts(CTransaction(invalid_with_csv_tx), state, &m_node.chainman->ActiveChainstate().CoinsTip(), SCRIPT_VERIFY_CHECKSEQUENCEVERIFY, true, true, txdata, nullptr));
309  }
310 
311  // TODO: add tests for remaining script flags
312 
313  // Test that passing CheckInputScripts with a valid witness doesn't imply success
314  // for the same tx with a different witness.
315  {
316  CMutableTransaction valid_with_witness_tx;
317  valid_with_witness_tx.nVersion = 1;
318  valid_with_witness_tx.vin.resize(1);
319  valid_with_witness_tx.vin[0].prevout.hash = spend_tx.GetHash();
320  valid_with_witness_tx.vin[0].prevout.n = 1;
321  valid_with_witness_tx.vout.resize(1);
322  valid_with_witness_tx.vout[0].nValue = 11*CENT;
323  valid_with_witness_tx.vout[0].scriptPubKey = p2pk_scriptPubKey;
324 
325  // Sign
326  SignatureData sigdata;
327  BOOST_CHECK(ProduceSignature(keystore, MutableTransactionSignatureCreator(valid_with_witness_tx, 0, 11 * CENT, SIGHASH_ALL), spend_tx.vout[1].scriptPubKey, sigdata));
328  UpdateInput(valid_with_witness_tx.vin[0], sigdata);
329 
330  // This should be valid under all script flags.
331  ValidateCheckInputsForAllFlags(CTransaction(valid_with_witness_tx), 0, true, m_node.chainman->ActiveChainstate().CoinsTip());
332 
333  // Remove the witness, and check that it is now invalid.
334  valid_with_witness_tx.vin[0].scriptWitness.SetNull();
335  ValidateCheckInputsForAllFlags(CTransaction(valid_with_witness_tx), SCRIPT_VERIFY_WITNESS, true, m_node.chainman->ActiveChainstate().CoinsTip());
336  }
337 
338  {
339  // Test a transaction with multiple inputs.
341 
342  tx.nVersion = 1;
343  tx.vin.resize(2);
344  tx.vin[0].prevout.hash = spend_tx.GetHash();
345  tx.vin[0].prevout.n = 0;
346  tx.vin[1].prevout.hash = spend_tx.GetHash();
347  tx.vin[1].prevout.n = 1;
348  tx.vout.resize(1);
349  tx.vout[0].nValue = 22*CENT;
350  tx.vout[0].scriptPubKey = p2pk_scriptPubKey;
351 
352  // Sign
353  for (int i = 0; i < 2; ++i) {
354  SignatureData sigdata;
355  BOOST_CHECK(ProduceSignature(keystore, MutableTransactionSignatureCreator(tx, i, 11 * CENT, SIGHASH_ALL), spend_tx.vout[i].scriptPubKey, sigdata));
356  UpdateInput(tx.vin[i], sigdata);
357  }
358 
359  // This should be valid under all script flags
360  ValidateCheckInputsForAllFlags(CTransaction(tx), 0, true, m_node.chainman->ActiveChainstate().CoinsTip());
361 
362  // Check that if the second input is invalid, but the first input is
363  // valid, the transaction is not cached.
364  // Invalidate vin[1]
365  tx.vin[1].scriptWitness.SetNull();
366 
367  TxValidationState state;
369  // This transaction is now invalid under segwit, because of the second input.
370  BOOST_CHECK(!CheckInputScripts(CTransaction(tx), state, &m_node.chainman->ActiveChainstate().CoinsTip(), SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS, true, true, txdata, nullptr));
371 
372  std::vector<CScriptCheck> scriptchecks;
373  // Make sure this transaction was not cached (ie because the first
374  // input was valid)
375  BOOST_CHECK(CheckInputScripts(CTransaction(tx), state, &m_node.chainman->ActiveChainstate().CoinsTip(), SCRIPT_VERIFY_P2SH | SCRIPT_VERIFY_WITNESS, true, true, txdata, &scriptchecks));
376  // Should get 2 script checks back -- caching is on a whole-transaction basis.
377  BOOST_CHECK_EQUAL(scriptchecks.size(), 2U);
378  }
379 }
380 
int ret
static const std::string REGTEST
Definition: block.h:68
node::NodeContext m_node
Definition: bitcoin-gui.cpp:37
std::vector< CTxIn > vin
Definition: transaction.h:374
virtual bool AddCScript(const CScript &redeemScript)
Bare scripts and BIP16 P2SH-wrapped redeemscripts.
const ResultType m_result_type
Result type.
Definition: validation.h:144
A signature creator for transactions.
Definition: sign.h:38
std::unique_ptr< CTxMemPool > mempool
Definition: context.h:50
iterator end()
Definition: prevector.h:294
#define LOCK(cs)
Definition: sync.h:261
Fast randomness source.
Definition: random.h:142
BOOST_AUTO_TEST_SUITE_END()
Fillable signing provider that keeps keys in an address->secret map.
static void ValidateCheckInputsForAllFlags(const CTransaction &tx, uint32_t failing_flags, bool add_to_cache, CCoinsViewCache &active_coins_tip) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
Definition: standard.cpp:334
Testing fixture that pre-creates a 100-block REGTEST-mode block chain.
Definition: setup_common.h:126
std::vector< CTxOut > vout
Definition: transaction.h:375
Validation result for a single transaction mempool acceptance.
Definition: validation.h:135
static CTransactionRef MakeTransactionRef(Tx &&txIn)
Definition: transaction.h:415
int flags
Definition: bitcoin-tx.cpp:525
std::vector< unsigned char > ToByteVector(const T &in)
Definition: script.h:63
uint256 GetHash() const
Definition: block.cpp:11
256-bit opaque blob.
Definition: uint256.h:119
#define EXCLUSIVE_LOCKS_REQUIRED(...)
Definition: threadsafety.h:49
#define BOOST_CHECK_EQUAL(v1, v2)
Definition: object.cpp:17
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:410
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate...
Definition: validation.cpp:121
void UpdateInput(CTxIn &input, const SignatureData &data)
Definition: sign.cpp:545
uint256 SignatureHash(const CScript &scriptCode, const T &txTo, unsigned int nIn, int nHashType, const CAmount &amount, SigVersion sigversion, const PrecomputedTransactionData *cache)
static int count
Definition: tests.c:33
bool ProduceSignature(const SigningProvider &provider, const BaseSignatureCreator &creator, const CScript &fromPubKey, SignatureData &sigdata)
Produce a script signature using a generic signature creator.
Definition: sign.cpp:384
iterator begin()
Definition: prevector.h:292
BOOST_AUTO_TEST_SUITE(cuckoocache_tests)
Test Suite for CuckooCache.
A mutable version of CTransaction.
Definition: transaction.h:372
static constexpr CAmount CENT
Definition: setup_common.h:78
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:287
bool CheckInputScripts(const CTransaction &tx, TxValidationState &state, const CCoinsViewCache &inputs, unsigned int flags, bool cacheSigStore, bool cacheFullScriptStore, PrecomputedTransactionData &txdata, std::vector< CScriptCheck > *pvChecks) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
Check whether all of this transaction&#39;s input scripts succeed.
CCoinsView that adds a memory cache for transactions to another CCoinsView.
Definition: coins.h:212
BOOST_FIXTURE_TEST_CASE(tx_mempool_block_doublespend, Dersig100Setup)
uint64_t randrange(uint64_t range) noexcept
Generate a random integer in the range [0..range).
Definition: random.h:213
std::unique_ptr< ChainstateManager > chainman
Definition: context.h:54
virtual bool AddKey(const CKey &key)
#define BOOST_CHECK(expr)
Definition: object.cpp:16