18 const CScript& coinbase_script = m_coinbase_txns[0]->vout[0].scriptPubKey;
19 for (
int i = 0; i < 10; i++) CreateAndProcessBlock({}, coinbase_script);
22 std::vector<COutPoint> spent(10);
23 std::vector<CMutableTransaction> spender(spent.size());
24 for (
size_t i = 0; i < spent.size(); i++) {
26 auto coinbase_tx = m_coinbase_txns[i];
27 spent[i] =
COutPoint(coinbase_tx->GetHash(), 0);
30 spender[i].version = 1;
31 spender[i].vin.resize(1);
32 spender[i].vin[0].prevout.hash = spent[i].hash;
33 spender[i].vin[0].prevout.n = spent[i].n;
34 spender[i].vout.resize(1);
35 spender[i].vout[0].nValue = coinbase_tx->GetValueOut();
36 spender[i].vout[0].scriptPubKey = coinbase_script;
39 std::vector<unsigned char> vchSig;
41 BOOST_REQUIRE(coinbaseKey.Sign(hash, vchSig));
43 spender[i].vin[0].scriptSig << vchSig;
47 const uint256 tip_hash = CreateAndProcessBlock(spender, coinbase_script).GetHash();
48 m_node.validation_signals->SyncWithValidationInterfaceQueue();
53 BOOST_REQUIRE(txospenderindex.
Init());
54 BOOST_CHECK(!txospenderindex.BlockUntilSyncedToCurrentChain());
58 for (
const auto& outpoint : spent) {
62 txospenderindex.
Sync();
65 for (
size_t i = 0; i < spent.size(); i++) {
66 const auto tx_spender{txospenderindex.
FindSpender(spent[i])};
67 BOOST_REQUIRE(tx_spender.has_value());
68 BOOST_REQUIRE(tx_spender->has_value());
74 txospenderindex.
Stop();
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
uint256 SignatureHash(const CScript &scriptCode, const T &txTo, unsigned int nIn, int32_t nHashType, const CAmount &amount, SigVersion sigversion, const PrecomputedTransactionData *cache, SigHashCache *sighash_cache)