Changeset View
Changeset View
Standalone View
Standalone View
src/test/util/mining.cpp
Show All 39 Lines | CTxIn MineBlock(const Config &config, const NodeContext &node, | ||||
return CTxIn{block->vtx[0]->GetId(), 0}; | return CTxIn{block->vtx[0]->GetId(), 0}; | ||||
} | } | ||||
std::shared_ptr<CBlock> PrepareBlock(const Config &config, | std::shared_ptr<CBlock> PrepareBlock(const Config &config, | ||||
const NodeContext &node, | const NodeContext &node, | ||||
const CScript &coinbase_scriptPubKey) { | const CScript &coinbase_scriptPubKey) { | ||||
auto block = std::make_shared<CBlock>( | auto block = std::make_shared<CBlock>( | ||||
BlockAssembler{config, *Assert(node.mempool)} | BlockAssembler{config, ::ChainstateActive(), *Assert(node.mempool)} | ||||
.CreateNewBlock(::ChainstateActive(), coinbase_scriptPubKey) | .CreateNewBlock(coinbase_scriptPubKey) | ||||
->block); | ->block); | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
block->nTime = ::ChainActive().Tip()->GetMedianTimePast() + 1; | block->nTime = ::ChainActive().Tip()->GetMedianTimePast() + 1; | ||||
block->hashMerkleRoot = BlockMerkleRoot(*block); | block->hashMerkleRoot = BlockMerkleRoot(*block); | ||||
return block; | return block; | ||||
} | } |