diff --git a/src/test/blockfilter_index_tests.cpp b/src/test/blockfilter_index_tests.cpp --- a/src/test/blockfilter_index_tests.cpp +++ b/src/test/blockfilter_index_tests.cpp @@ -167,9 +167,9 @@ GetScriptForDestination(PKHash(coinbaseKey.GetPubKey())); std::vector> chainA, chainB; BOOST_REQUIRE( - BuildChain(tip, coinbase_script_pub_key, 10, chainA, ::g_mempool)); + BuildChain(tip, coinbase_script_pub_key, 10, chainA, *m_node.mempool)); BOOST_REQUIRE( - BuildChain(tip, coinbase_script_pub_key, 10, chainB, ::g_mempool)); + BuildChain(tip, coinbase_script_pub_key, 10, chainB, *m_node.mempool)); // Check that new blocks on chain A get indexed. uint256 chainA_last_header = last_header; diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -126,32 +126,33 @@ // This tx has a low fee: 1000 satoshis. // Save this txid for later use. TxId parentTxId = tx.GetId(); - g_mempool.addUnchecked(entry.Fee(1000 * SATOSHI) - .Time(GetTime()) - .SpendsCoinbase(true) - .FromTx(tx)); + m_node.mempool->addUnchecked(entry.Fee(1000 * SATOSHI) + .Time(GetTime()) + .SpendsCoinbase(true) + .FromTx(tx)); // This tx has a medium fee: 10000 satoshis. tx.vin[0].prevout = COutPoint(txFirst[1]->GetId(), 0); tx.vout[0].nValue = int64_t(5000000000LL - 10000) * SATOSHI; TxId mediumFeeTxId = tx.GetId(); - g_mempool.addUnchecked(entry.Fee(10000 * SATOSHI) - .Time(GetTime()) - .SpendsCoinbase(true) - .FromTx(tx)); + m_node.mempool->addUnchecked(entry.Fee(10000 * SATOSHI) + .Time(GetTime()) + .SpendsCoinbase(true) + .FromTx(tx)); // This tx has a high fee, but depends on the first transaction. tx.vin[0].prevout = COutPoint(parentTxId, 0); // 50k satoshi fee. tx.vout[0].nValue = int64_t(5000000000LL - 1000 - 50000) * SATOSHI; TxId highFeeTxId = tx.GetId(); - g_mempool.addUnchecked(entry.Fee(50000 * SATOSHI) - .Time(GetTime()) - .SpendsCoinbase(false) - .FromTx(tx)); + m_node.mempool->addUnchecked(entry.Fee(50000 * SATOSHI) + .Time(GetTime()) + .SpendsCoinbase(false) + .FromTx(tx)); std::unique_ptr pblocktemplate = - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey); + AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey); BOOST_CHECK(pblocktemplate->block.vtx[1]->GetId() == parentTxId); BOOST_CHECK(pblocktemplate->block.vtx[2]->GetId() == highFeeTxId); BOOST_CHECK(pblocktemplate->block.vtx[3]->GetId() == mediumFeeTxId); @@ -161,7 +162,7 @@ // 0 fee. tx.vout[0].nValue = int64_t(5000000000LL - 1000 - 50000) * SATOSHI; TxId freeTxId = tx.GetId(); - g_mempool.addUnchecked(entry.Fee(Amount::zero()).FromTx(tx)); + m_node.mempool->addUnchecked(entry.Fee(Amount::zero()).FromTx(tx)); size_t freeTxSize = GetSerializeSize(tx, PROTOCOL_VERSION); // Calculate a fee on child transaction that will put the package just @@ -172,9 +173,9 @@ tx.vout[0].nValue = int64_t(5000000000LL - 1000 - 50000) * SATOSHI - feeToUse; TxId lowFeeTxId = tx.GetId(); - g_mempool.addUnchecked(entry.Fee(feeToUse).FromTx(tx)); - pblocktemplate = - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey); + m_node.mempool->addUnchecked(entry.Fee(feeToUse).FromTx(tx)); + pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey); // Verify that the free tx and the low fee tx didn't get selected. for (const auto &txn : pblocktemplate->block.vtx) { BOOST_CHECK(txn->GetId() != freeTxId); @@ -184,13 +185,13 @@ // Test that packages above the min relay fee do get included, even if one // of the transactions is below the min relay fee. Remove the low fee // transaction and replace with a higher fee transaction - g_mempool.removeRecursive(CTransaction(tx)); + m_node.mempool->removeRecursive(CTransaction(tx)); // Now we should be just over the min relay fee. tx.vout[0].nValue -= 2 * SATOSHI; lowFeeTxId = tx.GetId(); - g_mempool.addUnchecked(entry.Fee(feeToUse + 2 * SATOSHI).FromTx(tx)); - pblocktemplate = - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey); + m_node.mempool->addUnchecked(entry.Fee(feeToUse + 2 * SATOSHI).FromTx(tx)); + pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey); BOOST_CHECK(pblocktemplate->block.vtx[4]->GetId() == freeTxId); BOOST_CHECK(pblocktemplate->block.vtx[5]->GetId() == lowFeeTxId); @@ -203,7 +204,7 @@ // 1BCC output. tx.vout[1].nValue = 100000000 * SATOSHI; TxId freeTxId2 = tx.GetId(); - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(Amount::zero()).SpendsCoinbase(true).FromTx(tx)); // This tx can't be mined by itself. @@ -212,10 +213,10 @@ feeToUse = blockMinFeeRate.GetFee(freeTxSize); tx.vout[0].nValue = int64_t(5000000000LL - 100000000) * SATOSHI - feeToUse; TxId lowFeeTxId2 = tx.GetId(); - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(feeToUse).SpendsCoinbase(false).FromTx(tx)); - pblocktemplate = - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey); + pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey); // Verify that this tx isn't selected. for (const auto &txn : pblocktemplate->block.vtx) { @@ -228,9 +229,9 @@ tx.vin[0].prevout = COutPoint(freeTxId2, 1); // 10k satoshi fee. tx.vout[0].nValue = (100000000 - 10000) * SATOSHI; - g_mempool.addUnchecked(entry.Fee(10000 * SATOSHI).FromTx(tx)); - pblocktemplate = - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey); + m_node.mempool->addUnchecked(entry.Fee(10000 * SATOSHI).FromTx(tx)); + pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey); BOOST_CHECK(pblocktemplate->block.vtx[8]->GetId() == lowFeeTxId2); } @@ -264,10 +265,10 @@ // Coinbase scriptSig has to contains the correct EB value // converted to MB, rounded down to the first decimal BOOST_AUTO_TEST_CASE(CheckCoinbase_EB) { - TestCoinbaseMessageEB(1000001, "/EB1.0/", ::g_mempool); - TestCoinbaseMessageEB(2000000, "/EB2.0/", ::g_mempool); - TestCoinbaseMessageEB(8000000, "/EB8.0/", ::g_mempool); - TestCoinbaseMessageEB(8320000, "/EB8.3/", ::g_mempool); + TestCoinbaseMessageEB(1000001, "/EB1.0/", *m_node.mempool); + TestCoinbaseMessageEB(2000000, "/EB2.0/", *m_node.mempool); + TestCoinbaseMessageEB(8000000, "/EB8.0/", *m_node.mempool); + TestCoinbaseMessageEB(8320000, "/EB8.3/", *m_node.mempool); } // NOTE: These tests rely on CreateNewBlock doing its own self-validation! @@ -290,7 +291,7 @@ fCheckpointsEnabled = false; // Simple block creation, nothing special yet: - BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, g_mempool) + BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) .CreateNewBlock(scriptPubKey)); // We can't make transactions until we have inputs. @@ -328,10 +329,10 @@ } LOCK(cs_main); - LOCK(::g_mempool.cs); + LOCK(m_node.mempool->cs); // Just to make sure we can still make simple blocks. - BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, g_mempool) + BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) .CreateNewBlock(scriptPubKey)); const Amount BLOCKSUBSIDY = 50 * COIN; @@ -357,30 +358,31 @@ const TxId txid = tx.GetId(); // Only first tx spends coinbase. bool spendsCoinbase = i == 0; - g_mempool.addUnchecked(entry.Fee(LOWFEE) - .Time(GetTime()) - .SpendsCoinbase(spendsCoinbase) - .FromTx(tx)); + m_node.mempool->addUnchecked(entry.Fee(LOWFEE) + .Time(GetTime()) + .SpendsCoinbase(spendsCoinbase) + .FromTx(tx)); tx.vin[0].prevout = COutPoint(txid, 0); } - BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, g_mempool) + BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) .CreateNewBlock(scriptPubKey)); - g_mempool.clear(); + m_node.mempool->clear(); // Orphan in mempool, template creation fails. - g_mempool.addUnchecked(entry.Fee(LOWFEE).Time(GetTime()).FromTx(tx)); - BOOST_CHECK_EXCEPTION( - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey), - std::runtime_error, HasReason("bad-txns-inputs-missingorspent")); - g_mempool.clear(); + m_node.mempool->addUnchecked(entry.Fee(LOWFEE).Time(GetTime()).FromTx(tx)); + BOOST_CHECK_EXCEPTION(AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey), + std::runtime_error, + HasReason("bad-txns-inputs-missingorspent")); + m_node.mempool->clear(); // Child with higher priority than parent. tx.vin[0].scriptSig = CScript() << OP_1; tx.vin[0].prevout = COutPoint(txFirst[1]->GetId(), 0); tx.vout[0].nValue = BLOCKSUBSIDY - HIGHFEE; TxId txid = tx.GetId(); - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(HIGHFEE).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); tx.vin[0].prevout = COutPoint(txid, 0); tx.vin.resize(2); @@ -389,11 +391,11 @@ // First txn output + fresh coinbase - new txn fee. tx.vout[0].nValue = tx.vout[0].nValue + BLOCKSUBSIDY - HIGHERFEE; txid = tx.GetId(); - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(HIGHERFEE).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); - BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, g_mempool) + BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) .CreateNewBlock(scriptPubKey)); - g_mempool.clear(); + m_node.mempool->clear(); // Coinbase in mempool, template creation fails. tx.vin.resize(1); @@ -402,13 +404,13 @@ tx.vout[0].nValue = Amount::zero(); txid = tx.GetId(); // Give it a fee so it'll get mined. - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(LOWFEE).Time(GetTime()).SpendsCoinbase(false).FromTx(tx)); // Should throw bad-tx-coinbase - BOOST_CHECK_EXCEPTION( - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey), - std::runtime_error, HasReason("bad-tx-coinbase")); - g_mempool.clear(); + BOOST_CHECK_EXCEPTION(AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey), + std::runtime_error, HasReason("bad-tx-coinbase")); + m_node.mempool->clear(); // Double spend txn pair in mempool, template creation fails. tx.vin[0].prevout = COutPoint(txFirst[0]->GetId(), 0); @@ -416,16 +418,17 @@ tx.vout[0].nValue = BLOCKSUBSIDY - HIGHFEE; tx.vout[0].scriptPubKey = CScript() << OP_1; txid = tx.GetId(); - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(HIGHFEE).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); tx.vout[0].scriptPubKey = CScript() << OP_2; txid = tx.GetId(); - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(HIGHFEE).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); - BOOST_CHECK_EXCEPTION( - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey), - std::runtime_error, HasReason("bad-txns-inputs-missingorspent")); - g_mempool.clear(); + BOOST_CHECK_EXCEPTION(AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey), + std::runtime_error, + HasReason("bad-txns-inputs-missingorspent")); + m_node.mempool->clear(); // Subsidy changing. int nHeight = ::ChainActive().Height(); @@ -440,7 +443,7 @@ next->BuildSkip(); ::ChainActive().SetTip(next); } - BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, g_mempool) + BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) .CreateNewBlock(scriptPubKey)); // Extend to a 210000-long block chain. while (::ChainActive().Tip()->nHeight < 210000) { @@ -454,7 +457,7 @@ ::ChainActive().SetTip(next); } - BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, g_mempool) + BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) .CreateNewBlock(scriptPubKey)); // Invalid p2sh txn in mempool, template creation fails @@ -464,20 +467,20 @@ script = CScript() << OP_0; tx.vout[0].scriptPubKey = GetScriptForDestination(ScriptHash(script)); txid = tx.GetId(); - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(LOWFEE).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); tx.vin[0].prevout = COutPoint(txid, 0); tx.vin[0].scriptSig = CScript() << std::vector(script.begin(), script.end()); tx.vout[0].nValue -= LOWFEE; txid = tx.GetId(); - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(LOWFEE).Time(GetTime()).SpendsCoinbase(false).FromTx(tx)); // Should throw blk-bad-inputs - BOOST_CHECK_EXCEPTION( - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey), - std::runtime_error, HasReason("blk-bad-inputs")); - g_mempool.clear(); + BOOST_CHECK_EXCEPTION(AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey), + std::runtime_error, HasReason("blk-bad-inputs")); + m_node.mempool->clear(); // Delete the dummy blocks again. while (::ChainActive().Tip()->nHeight > nHeight) { @@ -509,7 +512,7 @@ tx.vout[0].scriptPubKey = CScript() << OP_1; tx.nLockTime = 0; txid = tx.GetId(); - g_mempool.addUnchecked( + m_node.mempool->addUnchecked( entry.Fee(HIGHFEE).Time(GetTime()).SpendsCoinbase(true).FromTx(tx)); const Consensus::Params ¶ms = chainparams.GetConsensus(); @@ -538,7 +541,7 @@ 1); prevheights[0] = baseheight + 2; txid = tx.GetId(); - g_mempool.addUnchecked(entry.Time(GetTime()).FromTx(tx)); + m_node.mempool->addUnchecked(entry.Time(GetTime()).FromTx(tx)); { // Locktime passes. @@ -575,7 +578,7 @@ prevheights[0] = baseheight + 3; tx.nLockTime = ::ChainActive().Tip()->nHeight + 1; txid = tx.GetId(); - g_mempool.addUnchecked(entry.Time(GetTime()).FromTx(tx)); + m_node.mempool->addUnchecked(entry.Time(GetTime()).FromTx(tx)); { // Locktime fails. @@ -603,7 +606,7 @@ prevheights.resize(1); prevheights[0] = baseheight + 4; txid = tx.GetId(); - g_mempool.addUnchecked(entry.Time(GetTime()).FromTx(tx)); + m_node.mempool->addUnchecked(entry.Time(GetTime()).FromTx(tx)); { // Locktime fails. @@ -651,8 +654,8 @@ // Sequence locks fail. BOOST_CHECK(!TestSequenceLocks(CTransaction(tx), flags)); - pblocktemplate = - AssemblerForTest(chainparams, g_mempool).CreateNewBlock(scriptPubKey); + pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) + .CreateNewBlock(scriptPubKey); BOOST_CHECK(pblocktemplate); // None of the of the absolute height/time locked tx should have made it @@ -672,13 +675,13 @@ ::ChainActive().Tip()->nHeight++; SetMockTime(::ChainActive().Tip()->GetMedianTimePast() + 1); - BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, g_mempool) + BOOST_CHECK(pblocktemplate = AssemblerForTest(chainparams, *m_node.mempool) .CreateNewBlock(scriptPubKey)); BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 5UL); ::ChainActive().Tip()->nHeight--; SetMockTime(0); - g_mempool.clear(); + m_node.mempool->clear(); TestPackageSelection(chainparams, scriptPubKey, txFirst); @@ -701,37 +704,38 @@ // Test around historical 1MB (plus one byte because that's mandatory) config.SetMaxBlockSize(ONE_MEGABYTE + 1); - CheckBlockMaxSize(config, ::g_mempool, 0, 1000); - CheckBlockMaxSize(config, ::g_mempool, 1000, 1000); - CheckBlockMaxSize(config, ::g_mempool, 1001, 1001); - CheckBlockMaxSize(config, ::g_mempool, 12345, 12345); + CheckBlockMaxSize(config, *m_node.mempool, 0, 1000); + CheckBlockMaxSize(config, *m_node.mempool, 1000, 1000); + CheckBlockMaxSize(config, *m_node.mempool, 1001, 1001); + CheckBlockMaxSize(config, *m_node.mempool, 12345, 12345); - CheckBlockMaxSize(config, ::g_mempool, ONE_MEGABYTE - 1001, + CheckBlockMaxSize(config, *m_node.mempool, ONE_MEGABYTE - 1001, ONE_MEGABYTE - 1001); - CheckBlockMaxSize(config, ::g_mempool, ONE_MEGABYTE - 1000, + CheckBlockMaxSize(config, *m_node.mempool, ONE_MEGABYTE - 1000, ONE_MEGABYTE - 1000); - CheckBlockMaxSize(config, ::g_mempool, ONE_MEGABYTE - 999, + CheckBlockMaxSize(config, *m_node.mempool, ONE_MEGABYTE - 999, + ONE_MEGABYTE - 999); + CheckBlockMaxSize(config, *m_node.mempool, ONE_MEGABYTE, ONE_MEGABYTE - 999); - CheckBlockMaxSize(config, ::g_mempool, ONE_MEGABYTE, ONE_MEGABYTE - 999); // Test around default cap config.SetMaxBlockSize(DEFAULT_MAX_BLOCK_SIZE); // Now we can use the default max block size. - CheckBlockMaxSize(config, ::g_mempool, DEFAULT_MAX_BLOCK_SIZE - 1001, + CheckBlockMaxSize(config, *m_node.mempool, DEFAULT_MAX_BLOCK_SIZE - 1001, DEFAULT_MAX_BLOCK_SIZE - 1001); - CheckBlockMaxSize(config, ::g_mempool, DEFAULT_MAX_BLOCK_SIZE - 1000, + CheckBlockMaxSize(config, *m_node.mempool, DEFAULT_MAX_BLOCK_SIZE - 1000, DEFAULT_MAX_BLOCK_SIZE - 1000); - CheckBlockMaxSize(config, ::g_mempool, DEFAULT_MAX_BLOCK_SIZE - 999, + CheckBlockMaxSize(config, *m_node.mempool, DEFAULT_MAX_BLOCK_SIZE - 999, DEFAULT_MAX_BLOCK_SIZE - 1000); - CheckBlockMaxSize(config, ::g_mempool, DEFAULT_MAX_BLOCK_SIZE, + CheckBlockMaxSize(config, *m_node.mempool, DEFAULT_MAX_BLOCK_SIZE, DEFAULT_MAX_BLOCK_SIZE - 1000); // If the parameter is not specified, we use // DEFAULT_MAX_GENERATED_BLOCK_SIZE { gArgs.ClearForcedArg("-blockmaxsize"); - BlockAssembler ba(config, g_mempool); + BlockAssembler ba(config, *m_node.mempool); BOOST_CHECK_EQUAL(ba.GetMaxGeneratedBlockSize(), DEFAULT_MAX_GENERATED_BLOCK_SIZE); } diff --git a/src/test/txvalidation_tests.cpp b/src/test/txvalidation_tests.cpp --- a/src/test/txvalidation_tests.cpp +++ b/src/test/txvalidation_tests.cpp @@ -36,17 +36,17 @@ LOCK(cs_main); - unsigned int initialPoolSize = g_mempool.size(); + unsigned int initialPoolSize = m_node.mempool->size(); BOOST_CHECK_EQUAL(false, - AcceptToMemoryPool(GetConfig(), g_mempool, state, + AcceptToMemoryPool(GetConfig(), *m_node.mempool, state, MakeTransactionRef(coinbaseTx), nullptr /* pfMissingInputs */, true /* bypass_limits */, Amount::zero() /* nAbsurdFee */)); // Check that the transaction hasn't been added to mempool. - BOOST_CHECK_EQUAL(g_mempool.size(), initialPoolSize); + BOOST_CHECK_EQUAL(m_node.mempool->size(), initialPoolSize); // Check that the validation state reflects the unsuccesful attempt. BOOST_CHECK(state.IsInvalid()); diff --git a/src/test/txvalidationcache_tests.cpp b/src/test/txvalidationcache_tests.cpp --- a/src/test/txvalidationcache_tests.cpp +++ b/src/test/txvalidationcache_tests.cpp @@ -76,7 +76,7 @@ LOCK(cs_main); BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash()); } - g_mempool.clear(); + m_node.mempool->clear(); // Test 3: ... and should be rejected if spend2 is in the memory pool BOOST_CHECK(ToMemPool(spends[1])); @@ -85,7 +85,7 @@ LOCK(cs_main); BOOST_CHECK(::ChainActive().Tip()->GetBlockHash() != block.GetHash()); } - g_mempool.clear(); + m_node.mempool->clear(); // Final sanity test: first spend in mempool, second in block, that's OK: std::vector oneSpend; @@ -98,7 +98,7 @@ } // spends[1] should have been removed from the mempool when the block with // spends[0] is accepted: - BOOST_CHECK_EQUAL(g_mempool.size(), 0U); + BOOST_CHECK_EQUAL(m_node.mempool->size(), 0U); } static inline bool diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -175,7 +175,7 @@ const std::vector &txns, const CScript &scriptPubKey) { const Config &config = GetConfig(); std::unique_ptr pblocktemplate = - BlockAssembler(config, g_mempool).CreateNewBlock(scriptPubKey); + BlockAssembler(config, *m_node.mempool).CreateNewBlock(scriptPubKey); CBlock &block = pblocktemplate->block; // Replace mempool-selected txns with just coinbase plus passed-in txns: diff --git a/src/test/validation_block_tests.cpp b/src/test/validation_block_tests.cpp --- a/src/test/validation_block_tests.cpp +++ b/src/test/validation_block_tests.cpp @@ -143,8 +143,9 @@ std::vector> blocks; while (blocks.size() < 50) { blocks.clear(); - BuildChain(config, ::g_mempool, chainParams.GenesisBlock().GetHash(), - 100, 15, 10, 500, blocks); + BuildChain(config, *m_node.mempool, + chainParams.GenesisBlock().GetHash(), 100, 15, 10, 500, + blocks); } bool ignored;