Changeset View
Changeset View
Standalone View
Standalone View
src/test/miner_tests.cpp
Show First 20 Lines • Show All 221 Lines • ▼ Show 20 Lines | void TestCoinbaseMessageEB(uint64_t eb, std::string cbmsg) { | ||||
std::unique_ptr<CBlockTemplate> pblocktemplate = | std::unique_ptr<CBlockTemplate> pblocktemplate = | ||||
BlockAssembler(config, g_mempool).CreateNewBlock(scriptPubKey); | BlockAssembler(config, g_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; | unsigned int extraNonce = 0; | ||||
IncrementExtraNonce(config, pblock, chainActive.Tip(), extraNonce); | IncrementExtraNonce(pblock, chainActive.Tip(), 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_FLAGS)); | COINBASE_FLAGS)); | ||||
} | } | ||||
// Coinbase scriptSig has to contains the correct EB value | // Coinbase scriptSig has to contains the correct EB value | ||||
▲ Show 20 Lines • Show All 532 Lines • Show Last 20 Lines |