Changeset View
Changeset View
Standalone View
Standalone View
src/policy/fees.cpp
Show First 20 Lines • Show All 349 Lines • ▼ Show 20 Lines | CBlockPolicyEstimator::CBlockPolicyEstimator(const CFeeRate &_minRelayFee) | ||||
vfeelist.push_back(double(INF_FEERATE.GetSatoshis())); | vfeelist.push_back(double(INF_FEERATE.GetSatoshis())); | ||||
feeStats.Initialize(vfeelist, MAX_BLOCK_CONFIRMS, DEFAULT_DECAY); | feeStats.Initialize(vfeelist, MAX_BLOCK_CONFIRMS, DEFAULT_DECAY); | ||||
} | } | ||||
void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry &entry, | void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry &entry, | ||||
bool validFeeEstimate) { | bool validFeeEstimate) { | ||||
uint32_t txHeight = entry.GetHeight(); | uint32_t txHeight = entry.GetHeight(); | ||||
uint256 txid = entry.GetTx().GetId(); | uint256 txid = entry.GetTx().GetHash(); | ||||
if (mapMemPoolTxs.count(txid)) { | if (mapMemPoolTxs.count(txid)) { | ||||
LogPrint("estimatefee", | LogPrint("estimatefee", | ||||
"Blockpolicy error mempool tx %s already being tracked\n", | "Blockpolicy error mempool tx %s already being tracked\n", | ||||
txid.ToString().c_str()); | txid.ToString().c_str()); | ||||
return; | return; | ||||
} | } | ||||
if (txHeight != nBestSeenHeight) { | if (txHeight != nBestSeenHeight) { | ||||
Show All 18 Lines | void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry &entry, | ||||
mapMemPoolTxs[txid].blockHeight = txHeight; | mapMemPoolTxs[txid].blockHeight = txHeight; | ||||
mapMemPoolTxs[txid].bucketIndex = | mapMemPoolTxs[txid].bucketIndex = | ||||
feeStats.NewTx(txHeight, double(feeRate.GetFeePerK().GetSatoshis())); | feeStats.NewTx(txHeight, double(feeRate.GetFeePerK().GetSatoshis())); | ||||
} | } | ||||
bool CBlockPolicyEstimator::processBlockTx(unsigned int nBlockHeight, | bool CBlockPolicyEstimator::processBlockTx(unsigned int nBlockHeight, | ||||
const CTxMemPoolEntry *entry) { | const CTxMemPoolEntry *entry) { | ||||
if (!removeTx(entry->GetTx().GetId())) { | if (!removeTx(entry->GetTx().GetHash())) { | ||||
// This transaction wasn't being tracked for fee estimation | // This transaction wasn't being tracked for fee estimation | ||||
return false; | return false; | ||||
} | } | ||||
// How many blocks did it take for miners to include this transaction? | // How many blocks did it take for miners to include this transaction? | ||||
// blocksToConfirm is 1-based, so a transaction included in the earliest | // blocksToConfirm is 1-based, so a transaction included in the earliest | ||||
// possible block has confirmation count of 1 | // possible block has confirmation count of 1 | ||||
int blocksToConfirm = nBlockHeight - entry->GetHeight(); | int blocksToConfirm = nBlockHeight - entry->GetHeight(); | ||||
▲ Show 20 Lines • Show All 179 Lines • Show Last 20 Lines |