5 #ifndef BITCOIN_POLICY_FEES_H 6 #define BITCOIN_POLICY_FEES_H 60 double withinTarget = 0;
61 double totalConfirmed = 0;
63 double leftMempool = 0;
72 unsigned int scale = 0;
79 int desiredTarget = 0;
80 int returnedTarget = 0;
135 static constexpr
unsigned int SHORT_BLOCK_PERIODS = 12;
136 static constexpr
unsigned int SHORT_SCALE = 1;
138 static constexpr
unsigned int MED_BLOCK_PERIODS = 24;
139 static constexpr
unsigned int MED_SCALE = 2;
141 static constexpr
unsigned int LONG_BLOCK_PERIODS = 42;
142 static constexpr
unsigned int LONG_SCALE = 24;
144 static const unsigned int OLDEST_ESTIMATE_HISTORY = 6 * 1008;
147 static constexpr
double SHORT_DECAY = .962;
149 static constexpr
double MED_DECAY = .9952;
151 static constexpr
double LONG_DECAY = .99931;
154 static constexpr
double HALF_SUCCESS_PCT = .6;
156 static constexpr
double SUCCESS_PCT = .85;
158 static constexpr
double DOUBLE_SUCCESS_PCT = .95;
161 static constexpr
double SUFFICIENT_FEETXS = 0.1;
163 static constexpr
double SUFFICIENT_TXS_SHORT = 0.5;
172 static constexpr
double MIN_BUCKET_FEERATE = 1000;
173 static constexpr
double MAX_BUCKET_FEERATE = 1e7;
180 static constexpr
double FEE_SPACING = 1.05;
188 void processBlock(
unsigned int nBlockHeight,
189 std::vector<const CTxMemPoolEntry*>& entries);
192 void processTransaction(
const CTxMemPoolEntry& entry,
bool validFeeEstimate);
195 bool removeTx(
uint256 hash,
bool inBlock);
198 CFeeRate estimateFee(
int confTarget)
const;
220 void FlushUnconfirmed();
231 unsigned int nBestSeenHeight
GUARDED_BY(m_cs_fee_estimator);
232 unsigned int firstRecordedHeight
GUARDED_BY(m_cs_fee_estimator);
233 unsigned int historicalFirst
GUARDED_BY(m_cs_fee_estimator);
234 unsigned int historicalBest
GUARDED_BY(m_cs_fee_estimator);
244 std::map<uint256, TxStatsInfo> mapMemPoolTxs
GUARDED_BY(m_cs_fee_estimator);
247 std::unique_ptr<TxConfirmStats> feeStats
PT_GUARDED_BY(m_cs_fee_estimator);
248 std::unique_ptr<TxConfirmStats> shortStats
PT_GUARDED_BY(m_cs_fee_estimator);
249 std::unique_ptr<TxConfirmStats> longStats
PT_GUARDED_BY(m_cs_fee_estimator);
251 unsigned int trackedTxs
GUARDED_BY(m_cs_fee_estimator);
252 unsigned int untrackedTxs
GUARDED_BY(m_cs_fee_estimator);
254 std::vector<double> buckets
GUARDED_BY(m_cs_fee_estimator);
255 std::map<double, unsigned int> bucketMap
GUARDED_BY(m_cs_fee_estimator);
275 static constexpr
double MAX_FILTER_FEERATE = 1e7;
280 static constexpr
double FEE_FILTER_SPACING = 1.1;
294 #endif // BITCOIN_POLICY_FEES_H
We will instantiate an instance of this class to track transactions that were included in a block...
std::string StringForFeeEstimateHorizon(FeeEstimateHorizon horizon)
Force estimateSmartFee to use conservative estimates.
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
int64_t CAmount
Amount in satoshis (Can be negative)
static constexpr auto ALL_FEE_ESTIMATE_HORIZONS
The BlockPolicyEstimator is used for estimating the feerate needed for a transaction to be included i...
FastRandomContext insecure_rand
#define EXCLUSIVE_LOCKS_REQUIRED(...)
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
Fee rate in satoshis per kilobyte: CAmount / kB.
RecursiveMutex m_cs_fee_estimator
std::set< double > feeset
Non-refcounted RAII wrapper for FILE*.