Changeset View
Changeset View
Standalone View
Standalone View
src/policy/fees.cpp
Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | if (foundAnswer && txSum != 0) { | ||||
} else { | } else { | ||||
// we're in the right bucket | // we're in the right bucket | ||||
median = avg[j] / txCtAvg[j]; | median = avg[j] / txCtAvg[j]; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
LogPrint(BCLog::ESTIMATEFEE, "%3d: For conf success %s %4.2f need feerate " | LogPrint( | ||||
"%s: %12.5g from buckets %8g - %8g Cur " | BCLog::ESTIMATEFEE, | ||||
"Bucket stats %6.2f%% %8.1f/(%.1f+%d " | "%3d: For conf success %s %4.2f need feerate %s: %12.5g from buckets " | ||||
"mempool)\n", | "%8g - %8g Cur Bucket stats %6.2f%% %8.1f/(%.1f+%d mempool)\n", | ||||
confTarget, requireGreater ? ">" : "<", successBreakPoint, | confTarget, requireGreater ? ">" : "<", successBreakPoint, | ||||
requireGreater ? ">" : "<", median, buckets[minBucket], | requireGreater ? ">" : "<", median, buckets[minBucket], | ||||
buckets[maxBucket], 100 * nConf / (totalNum + extraNum), nConf, | buckets[maxBucket], 100 * nConf / (totalNum + extraNum), nConf, | ||||
totalNum, extraNum); | totalNum, extraNum); | ||||
return CFeeRate(int64_t(ceill(median)) * SATOSHI); | return CFeeRate(int64_t(ceill(median)) * SATOSHI); | ||||
} | } | ||||
void TxConfirmStats::Write(CAutoFile &fileout) { | void TxConfirmStats::Write(CAutoFile &fileout) { | ||||
fileout << decay; | fileout << decay; | ||||
fileout << buckets; | fileout << buckets; | ||||
fileout << avg; | fileout << avg; | ||||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Lines | if (blocksAgo < 0) { | ||||
"Blockpolicy error, blocks ago is negative for mempool tx\n"); | "Blockpolicy error, blocks ago is negative for mempool tx\n"); | ||||
return; | return; | ||||
} | } | ||||
if (blocksAgo >= (int)unconfTxs.size()) { | if (blocksAgo >= (int)unconfTxs.size()) { | ||||
if (oldUnconfTxs[bucketindex] > 0) { | if (oldUnconfTxs[bucketindex] > 0) { | ||||
oldUnconfTxs[bucketindex]--; | oldUnconfTxs[bucketindex]--; | ||||
} else { | } else { | ||||
LogPrint(BCLog::ESTIMATEFEE, "Blockpolicy error, mempool tx " | LogPrint(BCLog::ESTIMATEFEE, | ||||
"removed from >25 " | "Blockpolicy error, mempool tx removed from >25 blocks, " | ||||
"blocks,bucketIndex=%u already\n", | "bucketIndex=%u already\n", | ||||
bucketindex); | bucketindex); | ||||
} | } | ||||
} else { | } else { | ||||
unsigned int blockIndex = entryHeight % unconfTxs.size(); | unsigned int blockIndex = entryHeight % unconfTxs.size(); | ||||
if (unconfTxs[blockIndex][bucketindex] > 0) { | if (unconfTxs[blockIndex][bucketindex] > 0) { | ||||
unconfTxs[blockIndex][bucketindex]--; | unconfTxs[blockIndex][bucketindex]--; | ||||
} else { | } else { | ||||
LogPrint(BCLog::ESTIMATEFEE, | LogPrint(BCLog::ESTIMATEFEE, | ||||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Lines | for (size_t i = 0; i < entries.size(); i++) { | ||||
if (processBlockTx(nBlockHeight, entries[i])) { | if (processBlockTx(nBlockHeight, entries[i])) { | ||||
countedTxs++; | countedTxs++; | ||||
} | } | ||||
} | } | ||||
// Update all exponential averages with the current block state | // Update all exponential averages with the current block state | ||||
feeStats.UpdateMovingAverages(); | feeStats.UpdateMovingAverages(); | ||||
LogPrint(BCLog::ESTIMATEFEE, "Blockpolicy after updating estimates for %u " | LogPrint(BCLog::ESTIMATEFEE, | ||||
"of %u txs in block, since last block %u of " | "Blockpolicy after updating estimates for %u of %u txs in block, " | ||||
"%u tracked, new mempool map size %u\n", | "since last block %u of %u tracked, new mempool map size %u\n", | ||||
countedTxs, entries.size(), trackedTxs, trackedTxs + untrackedTxs, | countedTxs, entries.size(), trackedTxs, trackedTxs + untrackedTxs, | ||||
mapMemPoolTxs.size()); | mapMemPoolTxs.size()); | ||||
trackedTxs = 0; | trackedTxs = 0; | ||||
untrackedTxs = 0; | untrackedTxs = 0; | ||||
} | } | ||||
CFeeRate CBlockPolicyEstimator::estimateFee(int confTarget) { | CFeeRate CBlockPolicyEstimator::estimateFee(int confTarget) { | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |