Changeset View
Changeset View
Standalone View
Standalone View
src/test/miner_tests.cpp
Show First 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | CScript scriptPubKey = | ||||
<< OP_CHECKSIG; | << OP_CHECKSIG; | ||||
std::unique_ptr<CBlockTemplate> pblocktemplate = | std::unique_ptr<CBlockTemplate> pblocktemplate = | ||||
BlockAssembler(config, mempool).CreateNewBlock(scriptPubKey); | BlockAssembler(config, mempool).CreateNewBlock(scriptPubKey); | ||||
CBlock *pblock = &pblocktemplate->block; | CBlock *pblock = &pblocktemplate->block; | ||||
// IncrementExtraNonce creates a valid coinbase and merkleRoot | // IncrementExtraNonce creates a valid coinbase and merkleRoot | ||||
unsigned int extraNonce = 0; | auto extraNonce = IncrementExtraNonce(pblock, ::ChainActive().Tip(), | ||||
IncrementExtraNonce(pblock, ::ChainActive().Tip(), config.GetMaxBlockSize(), | config.GetMaxBlockSize()); | ||||
extraNonce); | |||||
unsigned int nHeight = ::ChainActive().Tip()->nHeight + 1; | unsigned int nHeight = ::ChainActive().Tip()->nHeight + 1; | ||||
std::vector<uint8_t> vec(cbmsg.begin(), cbmsg.end()); | std::vector<uint8_t> vec(cbmsg.begin(), cbmsg.end()); | ||||
BOOST_CHECK(pblock->vtx[0]->vin[0].scriptSig == | BOOST_CHECK(pblock->vtx[0]->vin[0].scriptSig == | ||||
(CScript() << nHeight << CScriptNum(extraNonce) << vec)); | (CScript() << nHeight << CScriptNum(extraNonce) << vec)); | ||||
} | } | ||||
// Coinbase scriptSig has to contains the correct EB value | // Coinbase scriptSig has to contains the correct EB value | ||||
// converted to MB, rounded down to the first decimal | // converted to MB, rounded down to the first decimal | ||||
▲ Show 20 Lines • Show All 489 Lines • Show Last 20 Lines |