Changeset View
Changeset View
Standalone View
Standalone View
src/test/test_bitcoin.cpp
Show First 20 Lines • Show All 163 Lines • ▼ Show 20 Lines | |||||
// | // | ||||
// Create a new block with just given transactions, coinbase paying to | // Create a new block with just given transactions, coinbase paying to | ||||
// scriptPubKey, and try to add it to the current chain. | // scriptPubKey, and try to add it to the current chain. | ||||
// | // | ||||
CBlock TestChain100Setup::CreateAndProcessBlock( | CBlock TestChain100Setup::CreateAndProcessBlock( | ||||
const std::vector<CMutableTransaction> &txns, const CScript &scriptPubKey) { | const std::vector<CMutableTransaction> &txns, const CScript &scriptPubKey) { | ||||
const Config &config = GetConfig(); | const Config &config = GetConfig(); | ||||
std::unique_ptr<CBlockTemplate> pblocktemplate = | std::unique_ptr<CBlockTemplate> pblocktemplate = | ||||
BlockAssembler(config, g_mempool).CreateNewBlock(scriptPubKey); | BlockAssembler(config, g_mempool).CreateNewBlock(config, scriptPubKey); | ||||
CBlock &block = pblocktemplate->block; | CBlock &block = pblocktemplate->block; | ||||
// Replace mempool-selected txns with just coinbase plus passed-in txns: | // Replace mempool-selected txns with just coinbase plus passed-in txns: | ||||
block.vtx.resize(1); | block.vtx.resize(1); | ||||
for (const CMutableTransaction &tx : txns) { | for (const CMutableTransaction &tx : txns) { | ||||
block.vtx.push_back(MakeTransactionRef(tx)); | block.vtx.push_back(MakeTransactionRef(tx)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |