Changeset View
Changeset View
Standalone View
Standalone View
src/miner.cpp
Show First 20 Lines • Show All 230 Lines • ▼ Show 20 Lines | BlockAssembler::CreateNewBlock(const CScript &scriptPubKeyIn) { | ||||
if (!TestBlockValidity(*config, state, *pblock, pindexPrev, | if (!TestBlockValidity(*config, state, *pblock, pindexPrev, | ||||
validationOptions)) { | validationOptions)) { | ||||
throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", | throw std::runtime_error(strprintf("%s: TestBlockValidity failed: %s", | ||||
__func__, | __func__, | ||||
FormatStateMessage(state))); | FormatStateMessage(state))); | ||||
} | } | ||||
int64_t nTime2 = GetTimeMicros(); | int64_t nTime2 = GetTimeMicros(); | ||||
LogPrint( | LogPrint(BCLog::BENCH, | ||||
BCLog::BENCH, "CreateNewBlock() packages: %.2fms (%d packages, %d " | "CreateNewBlock() packages: %.2fms (%d packages, %d updated " | ||||
"updated descendants), validity: %.2fms (total %.2fms)\n", | "descendants), validity: %.2fms (total %.2fms)\n", | ||||
0.001 * (nTime1 - nTimeStart), nPackagesSelected, nDescendantsUpdated, | 0.001 * (nTime1 - nTimeStart), nPackagesSelected, | ||||
0.001 * (nTime2 - nTime1), 0.001 * (nTime2 - nTimeStart)); | nDescendantsUpdated, 0.001 * (nTime2 - nTime1), | ||||
0.001 * (nTime2 - nTimeStart)); | |||||
return std::move(pblocktemplate); | return std::move(pblocktemplate); | ||||
} | } | ||||
bool BlockAssembler::isStillDependent(CTxMemPool::txiter iter) { | bool BlockAssembler::isStillDependent(CTxMemPool::txiter iter) { | ||||
for (CTxMemPool::txiter parent : mempool->GetMemPoolParents(iter)) { | for (CTxMemPool::txiter parent : mempool->GetMemPoolParents(iter)) { | ||||
if (!inBlock.count(parent)) { | if (!inBlock.count(parent)) { | ||||
return true; | return true; | ||||
▲ Show 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
/** | /** | ||||
* addPackageTx includes transactions paying a fee by ensuring that | * addPackageTx includes transactions paying a fee by ensuring that | ||||
* the partial ordering of transactions is maintained. That is to say | * the partial ordering of transactions is maintained. That is to say | ||||
* children come after parents, despite having a potentially larger fee. | * children come after parents, despite having a potentially larger fee. | ||||
* @param[out] nPackagesSelected How many packages were selected | * @param[out] nPackagesSelected How many packages were selected | ||||
* @param[out] nDescendantsUpdated Number of descendant transactions updated | * @param[out] nDescendantsUpdated Number of descendant transactions updated | ||||
*/ | */ | ||||
void BlockAssembler::addPackageTxs(int &nPackagesSelected, | void BlockAssembler::addPackageTxs(int &nPackagesSelected, | ||||
int &nDescendantsUpdated) { | int &nDescendantsUpdated) { | ||||
// selection algorithm orders the mempool based on feerate of a | // selection algorithm orders the mempool based on feerate of a | ||||
// transaction including all unconfirmed ancestors. Since we don't remove | // transaction including all unconfirmed ancestors. Since we don't remove | ||||
// transactions from the mempool as we select them for block inclusion, we | // transactions from the mempool as we select them for block inclusion, we | ||||
// need an alternate method of updating the feerate of a transaction with | // need an alternate method of updating the feerate of a transaction with | ||||
// its not-yet-selected ancestors as we go. This is accomplished by | // its not-yet-selected ancestors as we go. This is accomplished by | ||||
▲ Show 20 Lines • Show All 266 Lines • Show Last 20 Lines |