Changeset View
Changeset View
Standalone View
Standalone View
src/miner.cpp
Show First 20 Lines • Show All 156 Lines • ▼ Show 20 Lines | BlockAssembler::CreateNewBlock(const CScript &scriptPubKeyIn) { | ||||
int nPackagesSelected = 0; | int nPackagesSelected = 0; | ||||
int nDescendantsUpdated = 0; | int nDescendantsUpdated = 0; | ||||
addPackageTxs(nPackagesSelected, nDescendantsUpdated); | addPackageTxs(nPackagesSelected, nDescendantsUpdated); | ||||
if (IsMagneticAnomalyEnabled(chainparams.GetConsensus(), pindexPrev)) { | if (IsMagneticAnomalyEnabled(chainparams.GetConsensus(), pindexPrev)) { | ||||
// If magnetic anomaly is enabled, we make sure transaction are | // If magnetic anomaly is enabled, we make sure transaction are | ||||
// canonically ordered. | // canonically ordered. | ||||
// FIXME: Use a zipped list. See T479 | |||||
std::sort(std::begin(pblocktemplate->entries) + 1, | std::sort(std::begin(pblocktemplate->entries) + 1, | ||||
std::end(pblocktemplate->entries), | std::end(pblocktemplate->entries), | ||||
[](const CBlockTemplateEntry &a, const CBlockTemplateEntry &b) | [](const CBlockTemplateEntry &a, const CBlockTemplateEntry &b) | ||||
-> bool { return a.tx->GetId() < b.tx->GetId(); }); | -> bool { return a.tx->GetId() < b.tx->GetId(); }); | ||||
} | } | ||||
// Copy all the transactions into the block | // Copy all the transactions refs into the block | ||||
// FIXME: This should be removed as it is significant overhead. | pblock->vtx.reserve(pblocktemplate->entries.size()); | ||||
// See T479 | for (const CBlockTemplateEntry &entry : pblocktemplate->entries) { | ||||
for (const CBlockTemplateEntry &tx : pblocktemplate->entries) { | pblock->vtx.push_back(entry.tx); | ||||
pblock->vtx.push_back(tx.tx); | |||||
} | } | ||||
int64_t nTime1 = GetTimeMicros(); | int64_t nTime1 = GetTimeMicros(); | ||||
nLastBlockTx = nBlockTx; | nLastBlockTx = nBlockTx; | ||||
nLastBlockSize = nBlockSize; | nLastBlockSize = nBlockSize; | ||||
// Create coinbase transaction. | // Create coinbase transaction. | ||||
▲ Show 20 Lines • Show All 380 Lines • Show Last 20 Lines |