5 #ifndef BITCOIN_POLICY_FEES_H 6 #define BITCOIN_POLICY_FEES_H 194 std::vector<const CTxMemPoolEntry*>& entries);
296 #endif // BITCOIN_POLICY_FEES_H static constexpr double MED_DECAY
Decay of .998 is a half-life of 144 blocks or about 1 day.
bool FeeModeFromString(const std::string &mode_string, FeeEstimateMode &fee_estimate_mode)
CCriticalSection cs_feeEstimator
static constexpr double MAX_BUCKET_FEERATE
static constexpr double HALF_SUCCESS_PCT
Require greater than 60% of X feerate transactions to be confirmed within Y/2 blocks.
unsigned int firstRecordedHeight
static constexpr unsigned int MED_BLOCK_PERIODS
Track confirm delays up to 48 blocks for medium horizon.
bool removeTx(uint256 hash, bool inBlock)
Remove a transaction from the mempool tracking stats.
CBlockPolicyEstimator()
Create new BlockPolicyEstimator and initialize stats tracking classes with default values...
bool Write(CAutoFile &fileout) const
Write estimation data to a file.
void FlushUnconfirmed()
Empty mempool transactions on shutdown to record failure to confirm for txs still in mempool...
static constexpr double MAX_FILTER_FEERATE
We will instantiate an instance of this class to track transactions that were included in a block...
std::map< double, unsigned int > bucketMap
std::unique_ptr< TxConfirmStats > shortStats
std::unique_ptr< TxConfirmStats > longStats
static constexpr double DOUBLE_SUCCESS_PCT
Require greater than 95% of X feerate transactions to be confirmed within 2 * Y blocks.
static constexpr double FEE_SPACING
Spacing of FeeRate buckets We have to lump transactions into buckets based on feerate, but we want to be able to give accurate estimates over a large range of potential feerates Therefore it makes sense to exponentially space the buckets.
unsigned int nBestSeenHeight
std::string StringForFeeEstimateHorizon(FeeEstimateHorizon horizon)
static constexpr double MIN_BUCKET_FEERATE
Minimum and Maximum values for tracking feerates The MIN_BUCKET_FEERATE should just be set to the low...
unsigned int MaxUsableEstimate() const
Calculation of highest target that reasonable estimate can be provided for.
static constexpr double SUFFICIENT_TXS_SHORT
Require an avg of 0.5 tx when using short decay since there are fewer blocks considered.
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
static constexpr double FEE_FILTER_SPACING
FEE_FILTER_SPACING is just used to provide some quantization of fee filter results.
int64_t CAmount
Amount in satoshis (Can be negative)
static constexpr double SUCCESS_PCT
Require greater than 85% of X feerate transactions to be confirmed within Y blocks.
std::unique_ptr< TxConfirmStats > feeStats
Classes to track historical data on transaction confirmations.
static constexpr unsigned int SHORT_SCALE
static constexpr double LONG_DECAY
Decay of .9995 is a half-life of 1008 blocks or about 1 week.
unsigned int HistoricalBlockSpan() const
Number of blocks of recorded fee estimate data represented in saved data file.
CFeeRate estimateRawFee(int confTarget, double successThreshold, FeeEstimateHorizon horizon, EstimationResult *result=nullptr) const
Return a specific fee estimate calculation with a given success threshold and time horizon...
The BlockPolicyEstimator is used for estimating the feerate needed for a transaction to be included i...
CFeeRate estimateSmartFee(int confTarget, FeeCalculation *feeCalc, bool conservative) const
Estimate feerate needed to get be included in a block within confTarget blocks.
unsigned int historicalFirst
double estimateConservativeFee(unsigned int doubleTarget, EstimationResult *result) const
Helper for estimateSmartFee.
Use default settings based on other criteria.
unsigned int BlockSpan() const
Number of blocks of data recorded while fee estimates have been running.
std::string StringForFeeReason(FeeReason reason)
FeeFilterRounder(const CFeeRate &minIncrementalFee)
Create new FeeFilterRounder.
std::map< uint256, TxStatsInfo > mapMemPoolTxs
FastRandomContext insecure_rand
CFeeRate estimateFee(int confTarget) const
DEPRECATED.
static constexpr unsigned int LONG_SCALE
double estimateCombinedFee(unsigned int confTarget, double successThreshold, bool checkShorterHorizon, EstimationResult *result) const
Helper for estimateSmartFee.
unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const
Calculation of highest target that estimates are tracked for.
static constexpr unsigned int MED_SCALE
static const unsigned int OLDEST_ESTIMATE_HISTORY
Historical estimates that are older than this aren't valid.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
void processBlock(unsigned int nBlockHeight, std::vector< const CTxMemPoolEntry *> &entries)
Process all the transactions that have been included in a block.
bool Read(CAutoFile &filein)
Read estimation data from a file.
unsigned int historicalBest
static constexpr unsigned int LONG_BLOCK_PERIODS
Track confirm delays up to 1008 blocks for long horizon.
Fee rate in satoshis per kilobyte: CAmount / kB.
std::vector< double > buckets
static constexpr unsigned int SHORT_BLOCK_PERIODS
Track confirm delays up to 12 blocks for short horizon.
static constexpr double SUFFICIENT_FEETXS
Require an avg of 0.1 tx in the combined feerate bucket per block to have stat significance.
bool processBlockTx(unsigned int nBlockHeight, const CTxMemPoolEntry *entry)
Process a transaction confirmed in a block.
Force estimateSmartFee to use non-conservative estimates.
CAmount round(CAmount currentMinFee)
Quantize a minimum fee for privacy purpose before broadcast.
static constexpr double SHORT_DECAY
Decay of .962 is a half-life of 18 blocks or about 3 hours.
std::set< double > feeset
unsigned int untrackedTxs
Non-refcounted RAII wrapper for FILE*.
void processTransaction(const CTxMemPoolEntry &entry, bool validFeeEstimate)
Process a transaction accepted to the mempool.