MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / removeTx

Method removeTx

src/policy/fees.cpp:470–505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468}
469
470void TxConfirmStats::removeTx(unsigned int entryHeight, unsigned int nBestSeenHeight, unsigned int bucketindex, bool inBlock)
471{
472 //nBestSeenHeight is not updated yet for the new block
473 int blocksAgo = nBestSeenHeight - entryHeight;
474 if (nBestSeenHeight == 0) // the BlockPolicyEstimator hasn't seen any blocks yet
475 blocksAgo = 0;
476 if (blocksAgo < 0) {
477 LogPrint(BCLog::ESTIMATEFEE, "Blockpolicy error, blocks ago is negative for mempool tx\n");
478 return; //This can't happen because we call this with our best seen height, no entries can have higher
479 }
480
481 if (blocksAgo >= (int)unconfTxs.size()) {
482 if (oldUnconfTxs[bucketindex] > 0) {
483 oldUnconfTxs[bucketindex]--;
484 } else {
485 LogPrint(BCLog::ESTIMATEFEE, "Blockpolicy error, mempool tx removed from >25 blocks,bucketIndex=%u already\n",
486 bucketindex);
487 }
488 }
489 else {
490 unsigned int blockIndex = entryHeight % unconfTxs.size();
491 if (unconfTxs[blockIndex][bucketindex] > 0) {
492 unconfTxs[blockIndex][bucketindex]--;
493 } else {
494 LogPrint(BCLog::ESTIMATEFEE, "Blockpolicy error, mempool tx removed from blockIndex=%u,bucketIndex=%u already\n",
495 blockIndex, bucketindex);
496 }
497 }
498 if (!inBlock && (unsigned int)blocksAgo >= scale) { // Only counts as a failure if not confirmed for entire period
499 assert(scale != 0);
500 unsigned int periodsAgo = blocksAgo / scale;
501 for (size_t i = 0; i < periodsAgo && i < failAvg.size(); i++) {
502 failAvg[i][bucketindex]++;
503 }
504 }
505}
506
507// This function is called from CTxMemPool::removeUnchecked to ensure
508// txs removed from the mempool for any reason are no longer

Callers 1

removeUncheckedMethod · 0.80

Calls 4

sizeMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected