diff --git a/src/miner.cpp b/src/miner.cpp --- a/src/miner.cpp +++ b/src/miner.cpp @@ -169,6 +169,13 @@ -> bool { return a.tx->GetId() < b.tx->GetId(); }); } + // Copy all the transactions into the block + // FIXME: This should be removed as it is significant overhead. + // See T479 + for (const CBlockTemplateEntry &tx : pblocktemplate->entries) { + pblock->vtx.push_back(tx.tx); + } + int64_t nTime1 = GetTimeMicros(); nLastBlockTx = nBlockTx; @@ -193,6 +200,7 @@ pblocktemplate->entries[0].tx = MakeTransactionRef(coinbaseTx); pblocktemplate->entries[0].fees = -1 * nFees; + pblock->vtx[0] = pblocktemplate->entries[0].tx; uint64_t nSerializeSize = GetSerializeSize(*pblock, PROTOCOL_VERSION); @@ -208,13 +216,6 @@ pblocktemplate->entries[0].sigOpCount = GetSigOpCountWithoutP2SH( *pblocktemplate->entries[0].tx, STANDARD_SCRIPT_VERIFY_FLAGS); - // Copy all the transactions into the block - // FIXME: This should be removed as it is significant overhead. - // See T479 - for (const CBlockTemplateEntry &tx : pblocktemplate->entries) { - pblock->vtx.push_back(tx.tx); - } - CValidationState state; if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, BlockValidationOptions(nMaxGeneratedBlockSize)