Changeset View
Changeset View
Standalone View
Standalone View
src/test/util.cpp
Show First 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
std::shared_ptr<CBlock> PrepareBlock(const Config &config, | std::shared_ptr<CBlock> PrepareBlock(const Config &config, | ||||
const CScript &coinbase_scriptPubKey) { | const CScript &coinbase_scriptPubKey) { | ||||
auto block = | auto block = | ||||
std::make_shared<CBlock>(BlockAssembler{config, ::g_mempool} | std::make_shared<CBlock>(BlockAssembler{config, ::g_mempool} | ||||
.CreateNewBlock(coinbase_scriptPubKey) | .CreateNewBlock(coinbase_scriptPubKey) | ||||
->block); | ->block); | ||||
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; | ||||
} | } |