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

Method processBlockTx

src/policy/fees.cpp:588–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586}
587
588bool CBlockPolicyEstimator::processBlockTx(unsigned int nBlockHeight, const CTxMemPoolEntry* entry)
589{
590 if (!removeTx(entry->GetTx().GetHash(), true)) {
591 // This transaction wasn't being tracked for fee estimation
592 return false;
593 }
594
595 // How many blocks did it take for miners to include this transaction?
596 // blocksToConfirm is 1-based, so a transaction included in the earliest
597 // possible block has confirmation count of 1
598 int blocksToConfirm = nBlockHeight - entry->GetHeight();
599 if (blocksToConfirm <= 0) {
600 // This can't happen because we don't process transactions from a block with a height
601 // lower than our greatest seen height
602 LogPrint(BCLog::ESTIMATEFEE, "Blockpolicy error Transaction had negative blocksToConfirm\n");
603 return false;
604 }
605
606 // Feerates are stored and reported as BTC-per-kb:
607 CFeeRate feeRate(entry->GetFee(), entry->GetTxSize());
608
609 feeStats->Record(blocksToConfirm, (double)feeRate.GetFeePerK());
610 shortStats->Record(blocksToConfirm, (double)feeRate.GetFeePerK());
611 longStats->Record(blocksToConfirm, (double)feeRate.GetFeePerK());
612 return true;
613}
614
615void CBlockPolicyEstimator::processBlock(unsigned int nBlockHeight,
616 std::vector<const CTxMemPoolEntry*>& entries)

Callers

nothing calls this directly

Calls 6

GetHeightMethod · 0.80
GetFeeMethod · 0.80
RecordMethod · 0.80
GetFeePerKMethod · 0.80
GetHashMethod · 0.45
GetTxSizeMethod · 0.45

Tested by

no test coverage detected