0
I am reading the code of rpc's estimateSmartFee method , and I can't understand why using blockIndex in unconfTxs ?
estimateSmartFee loop unconfTxs to get feeRate(code: https://github.com/bitcoin/bitcoin/blob/0.18/src/policy/fees.cpp#L291)
But the value unconfTxs[blockIndex][bucketindex] will be reseted in TxConfirmStats::ClearCurrent or reduced in TxConfirmStats::removeTx.
Why not just define like this unconfTxs[bucketindex]?
source file fees.cpp
unsigned int TxConfirmStats::NewTx(unsigned int nBlockHeight, double val)
{
unsigned int bucketindex = bucketMap.lower_bound(val)->second;
unsigned int blockIndex = nBlockHeight % unconfTxs.size();
unconfTxs[blockIndex][bucketindex]++;
return bucketindex;
}
the unconfTxs
// Mempool counts of outstanding transactions
// For each bucket X, track the number of transactions in the mempool
// that are unconfirmed for each possible confirmation value Y
std::vector<std::vector<int> > unconfTxs; //unconfTxs[Y][X]