Changeset View
Changeset View
Standalone View
Standalone View
src/test/validation_block_tests.cpp
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
std::shared_ptr<CBlock> Block(const Config &config, const uint256 &prev_hash) { | std::shared_ptr<CBlock> Block(const Config &config, const uint256 &prev_hash) { | ||||
static int i = 0; | static int i = 0; | ||||
static uint64_t time = config.GetChainParams().GenesisBlock().nTime; | static uint64_t time = config.GetChainParams().GenesisBlock().nTime; | ||||
CScript pubKey; | CScript pubKey; | ||||
pubKey << i++ << OP_TRUE; | pubKey << i++ << OP_TRUE; | ||||
auto ptemplate = BlockAssembler(config, g_mempool).CreateNewBlock(pubKey); | auto ptemplate = | ||||
BlockAssembler(config, g_mempool).CreateNewBlock(config, pubKey); | |||||
auto pblock = std::make_shared<CBlock>(ptemplate->block); | auto pblock = std::make_shared<CBlock>(ptemplate->block); | ||||
pblock->hashPrevBlock = prev_hash; | pblock->hashPrevBlock = prev_hash; | ||||
pblock->nTime = ++time; | pblock->nTime = ++time; | ||||
CMutableTransaction txCoinbase(*pblock->vtx[0]); | CMutableTransaction txCoinbase(*pblock->vtx[0]); | ||||
txCoinbase.vout.resize(1); | txCoinbase.vout.resize(1); | ||||
pblock->vtx[0] = MakeTransactionRef(std::move(txCoinbase)); | pblock->vtx[0] = MakeTransactionRef(std::move(txCoinbase)); | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |