6 #ifndef RAVEN_POLICYESTIMATOR_H 7 #define RAVEN_POLICYESTIMATOR_H 111 double withinTarget = 0;
112 double totalConfirmed = 0;
113 double inMempool = 0;
114 double leftMempool = 0;
123 unsigned int scale = 0;
130 int desiredTarget = 0;
131 int returnedTarget = 0;
143 static constexpr
unsigned int SHORT_BLOCK_PERIODS = 12;
144 static constexpr
unsigned int SHORT_SCALE = 1;
146 static constexpr
unsigned int MED_BLOCK_PERIODS = 24;
147 static constexpr
unsigned int MED_SCALE = 2;
149 static constexpr
unsigned int LONG_BLOCK_PERIODS = 42;
150 static constexpr
unsigned int LONG_SCALE = 24;
152 static const unsigned int OLDEST_ESTIMATE_HISTORY = 6 * 1008;
155 static constexpr
double SHORT_DECAY = .962;
157 static constexpr
double MED_DECAY = .9952;
159 static constexpr
double LONG_DECAY = .99931;
162 static constexpr
double HALF_SUCCESS_PCT = .6;
164 static constexpr
double SUCCESS_PCT = .85;
166 static constexpr
double DOUBLE_SUCCESS_PCT = .95;
169 static constexpr
double SUFFICIENT_FEETXS = 0.1;
171 static constexpr
double SUFFICIENT_TXS_SHORT = 0.5;
180 static constexpr
double MIN_BUCKET_FEERATE = 1000;
181 static constexpr
double MAX_BUCKET_FEERATE = 1e7;
188 static constexpr
double FEE_SPACING = 1.05;
196 void processBlock(
unsigned int nBlockHeight,
197 std::vector<const CTxMemPoolEntry*>& entries);
200 void processTransaction(
const CTxMemPoolEntry& entry,
bool validFeeEstimate);
203 bool removeTx(
uint256 hash,
bool inBlock);
206 CFeeRate estimateFee(
int confTarget)
const;
263 bool processBlockTx(
unsigned int nBlockHeight,
const CTxMemPoolEntry* entry);
266 double estimateCombinedFee(
unsigned int confTarget,
double successThreshold,
bool checkShorterHorizon,
EstimationResult *result)
const;
268 double estimateConservativeFee(
unsigned int doubleTarget,
EstimationResult *result)
const;
270 unsigned int BlockSpan()
const;
272 unsigned int HistoricalBlockSpan()
const;
274 unsigned int MaxUsableEstimate()
const;
280 static constexpr
double MAX_FILTER_FEERATE = 1e7;
285 static constexpr
double FEE_FILTER_SPACING = 1.1;
300 static const std::array<int, 9> confTargets = { {2, 4, 6, 12, 24, 48, 144, 504, 1008} };
bool FeeModeFromString(const std::string &mode_string, FeeEstimateMode &fee_estimate_mode)
CCriticalSection cs_feeEstimator
unsigned int firstRecordedHeight
We will instantiate an instance of this class to track transactions that were included in a block...
std::map< double, unsigned int > bucketMap
int getIndexForConfTarget(int target)
unsigned int nBestSeenHeight
std::string StringForFeeEstimateHorizon(FeeEstimateHorizon horizon)
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
TxConfirmStats * longStats
int64_t CAmount
Amount in corbies (Can be negative)
TxConfirmStats * feeStats
Classes to track historical data on transaction confirmations.
We want to be able to estimate feerates that are needed on tx's to be included in a certain number of...
unsigned int historicalFirst
std::string StringForFeeReason(FeeReason reason)
std::map< uint256, TxStatsInfo > mapMemPoolTxs
FastRandomContext insecure_rand
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
unsigned int historicalBest
Fee rate in satoshis per kilobyte: CAmount / kB.
std::vector< double > buckets
Use default settings based on other criteria.
TxConfirmStats * shortStats
std::set< double > feeset
unsigned int untrackedTxs
int getConfTargetForIndex(int index)
Non-refcounted RAII wrapper for FILE*.
Wrapped boost mutex: supports recursive locking, but no waiting TODO: We should move away from using ...