mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-25 16:31:29 +02:00
test/util: Use existing chainman in ::PrepareBlock
This commit is contained in:
parent
464c313e30
commit
f0dd5e6bb4
@ -74,12 +74,12 @@ CTxIn MineBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey)
|
|||||||
std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey)
|
std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, const CScript& coinbase_scriptPubKey)
|
||||||
{
|
{
|
||||||
auto block = std::make_shared<CBlock>(
|
auto block = std::make_shared<CBlock>(
|
||||||
BlockAssembler{::ChainstateActive(), *Assert(node.mempool), Params()}
|
BlockAssembler{Assert(node.chainman)->ActiveChainstate(), *Assert(node.mempool), Params()}
|
||||||
.CreateNewBlock(coinbase_scriptPubKey)
|
.CreateNewBlock(coinbase_scriptPubKey)
|
||||||
->block);
|
->block);
|
||||||
|
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
block->nTime = ::ChainActive().Tip()->GetMedianTimePast() + 1;
|
block->nTime = Assert(node.chainman)->ActiveChain().Tip()->GetMedianTimePast() + 1;
|
||||||
block->hashMerkleRoot = BlockMerkleRoot(*block);
|
block->hashMerkleRoot = BlockMerkleRoot(*block);
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user