5 #ifndef BITCOIN_POLICY_FEES_H 6 #define BITCOIN_POLICY_FEES_H 53 double withinTarget = 0;
54 double totalConfirmed = 0;
56 double leftMempool = 0;
65 unsigned int scale = 0;
72 int desiredTarget = 0;
73 int returnedTarget = 0;
128 static constexpr
unsigned int SHORT_BLOCK_PERIODS = 12;
129 static constexpr
unsigned int SHORT_SCALE = 1;
131 static constexpr
unsigned int MED_BLOCK_PERIODS = 24;
132 static constexpr
unsigned int MED_SCALE = 2;
134 static constexpr
unsigned int LONG_BLOCK_PERIODS = 42;
135 static constexpr
unsigned int LONG_SCALE = 24;
137 static const unsigned int OLDEST_ESTIMATE_HISTORY = 6 * 1008;
140 static constexpr
double SHORT_DECAY = .962;
142 static constexpr
double MED_DECAY = .9952;
144 static constexpr
double LONG_DECAY = .99931;
147 static constexpr
double HALF_SUCCESS_PCT = .6;
149 static constexpr
double SUCCESS_PCT = .85;
151 static constexpr
double DOUBLE_SUCCESS_PCT = .95;
154 static constexpr
double SUFFICIENT_FEETXS = 0.1;
156 static constexpr
double SUFFICIENT_TXS_SHORT = 0.5;
165 static constexpr
double MIN_BUCKET_FEERATE = 1000;
166 static constexpr
double MAX_BUCKET_FEERATE = 1e7;
173 static constexpr
double FEE_SPACING = 1.05;
181 void processBlock(
unsigned int nBlockHeight,
182 std::vector<const CTxMemPoolEntry*>& entries);
185 void processTransaction(
const CTxMemPoolEntry& entry,
bool validFeeEstimate);
188 bool removeTx(
uint256 hash,
bool inBlock);
191 CFeeRate estimateFee(
int confTarget)
const;
213 void FlushUnconfirmed();
221 unsigned int nBestSeenHeight
GUARDED_BY(m_cs_fee_estimator);
222 unsigned int firstRecordedHeight
GUARDED_BY(m_cs_fee_estimator);
223 unsigned int historicalFirst
GUARDED_BY(m_cs_fee_estimator);
224 unsigned int historicalBest
GUARDED_BY(m_cs_fee_estimator);
234 std::map<uint256, TxStatsInfo> mapMemPoolTxs
GUARDED_BY(m_cs_fee_estimator);
237 std::unique_ptr<TxConfirmStats> feeStats
PT_GUARDED_BY(m_cs_fee_estimator);
238 std::unique_ptr<TxConfirmStats> shortStats
PT_GUARDED_BY(m_cs_fee_estimator);
239 std::unique_ptr<TxConfirmStats> longStats
PT_GUARDED_BY(m_cs_fee_estimator);
241 unsigned int trackedTxs
GUARDED_BY(m_cs_fee_estimator);
242 unsigned int untrackedTxs
GUARDED_BY(m_cs_fee_estimator);
244 std::vector<double> buckets
GUARDED_BY(m_cs_fee_estimator);
245 std::map<double, unsigned int> bucketMap
GUARDED_BY(m_cs_fee_estimator);
265 static constexpr
double MAX_FILTER_FEERATE = 1e7;
270 static constexpr
double FEE_FILTER_SPACING = 1.1;
284 #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)
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*.