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

Method processTransaction

src/policy/fees.cpp:549–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

547}
548
549void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, bool validFeeEstimate)
550{
551 LOCK(cs_feeEstimator);
552 unsigned int txHeight = entry.GetHeight();
553 uint256 hash = entry.GetTx().GetHash();
554 if (mapMemPoolTxs.count(hash)) {
555 LogPrint(BCLog::ESTIMATEFEE, "Blockpolicy error mempool tx %s already being tracked\n",
556 hash.ToString().c_str());
557 return;
558 }
559
560 if (txHeight != nBestSeenHeight) {
561 // Ignore side chains and re-orgs; assuming they are random they don't
562 // affect the estimate. We'll potentially double count transactions in 1-block reorgs.
563 // Ignore txs if BlockPolicyEstimator is not in sync with chainActive.Tip().
564 // It will be synced next time a block is processed.
565 return;
566 }
567
568 // Only want to be updating estimates when our blockchain is synced,
569 // otherwise we'll miscalculate how many blocks its taking to get included.
570 if (!validFeeEstimate) {
571 untrackedTxs++;
572 return;
573 }
574 trackedTxs++;
575
576 // Feerates are stored and reported as BTC-per-kb:
577 CFeeRate feeRate(entry.GetFee(), entry.GetTxSize());
578
579 mapMemPoolTxs[hash].blockHeight = txHeight;
580 unsigned int bucketIndex = feeStats->NewTx(txHeight, (double)feeRate.GetFeePerK());
581 mapMemPoolTxs[hash].bucketIndex = bucketIndex;
582 unsigned int bucketIndex2 = shortStats->NewTx(txHeight, (double)feeRate.GetFeePerK());
583 assert(bucketIndex == bucketIndex2);
584 unsigned int bucketIndex3 = longStats->NewTx(txHeight, (double)feeRate.GetFeePerK());
585 assert(bucketIndex == bucketIndex3);
586}
587
588bool CBlockPolicyEstimator::processBlockTx(unsigned int nBlockHeight, const CTxMemPoolEntry* entry)
589{

Callers 1

addUncheckedMethod · 0.80

Calls 8

GetHeightMethod · 0.80
GetFeeMethod · 0.80
NewTxMethod · 0.80
GetFeePerKMethod · 0.80
GetHashMethod · 0.45
countMethod · 0.45
ToStringMethod · 0.45
GetTxSizeMethod · 0.45

Tested by

no test coverage detected