diff options
author | Carl Dong <contact@carldong.me> | 2022-05-25 22:06:23 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2022-06-06 15:38:09 -0400 |
commit | 0f1a259657280afc727db97689512aef5ca928fc (patch) | |
tree | df44289c04dd3c24f631b92399c1c6a02811f4ae /src/test/validation_block_tests.cpp | |
parent | cc5739b27df830d138119eaa13f2286d91d0dadd (diff) |
miner: Make mempool optional for BlockAssembler
...also adjust callers
Changes:
- In BlockAssembler::CreateNewBlock, we now only lock m_mempool->cs and
call addPackageTxs if m_mempool is not nullptr
- BlockAssembler::addPackageTxs now takes in a mempool reference, and is
annotated to require that mempool's lock.
- In TestChain100Setup::CreateBlock and generateblock, don't construct
an empty mempool, just pass in a nullptr for mempool
Diffstat (limited to 'src/test/validation_block_tests.cpp')
-rw-r--r-- | src/test/validation_block_tests.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/validation_block_tests.cpp b/src/test/validation_block_tests.cpp index 331da691b5..7ade4d8195 100644 --- a/src/test/validation_block_tests.cpp +++ b/src/test/validation_block_tests.cpp @@ -65,7 +65,7 @@ std::shared_ptr<CBlock> MinerTestingSetup::Block(const uint256& prev_hash) static int i = 0; static uint64_t time = Params().GenesisBlock().nTime; - auto ptemplate = BlockAssembler{m_node.chainman->ActiveChainstate(), *m_node.mempool}.CreateNewBlock(CScript{} << i++ << OP_TRUE); + auto ptemplate = BlockAssembler{m_node.chainman->ActiveChainstate(), m_node.mempool.get()}.CreateNewBlock(CScript{} << i++ << OP_TRUE); auto pblock = std::make_shared<CBlock>(ptemplate->block); pblock->hashPrevBlock = prev_hash; pblock->nTime = ++time; @@ -327,7 +327,7 @@ BOOST_AUTO_TEST_CASE(witness_commitment_index) { CScript pubKey; pubKey << 1 << OP_TRUE; - auto ptemplate = BlockAssembler{m_node.chainman->ActiveChainstate(), *m_node.mempool}.CreateNewBlock(pubKey); + auto ptemplate = BlockAssembler{m_node.chainman->ActiveChainstate(), m_node.mempool.get()}.CreateNewBlock(pubKey); CBlock pblock = ptemplate->block; CTxOut witness; |