5 #ifndef FABCOIN_POLICYESTIMATOR_H 6 #define FABCOIN_POLICYESTIMATOR_H 109 double withinTarget = 0;
110 double totalConfirmed = 0;
111 double inMempool = 0;
112 double leftMempool = 0;
121 unsigned int scale = 0;
128 int desiredTarget = 0;
129 int returnedTarget = 0;
133 static const unsigned int MAX_BLOCK_CONFIRMS = 25;
136 static const double DEFAULT_DECAY = .998;
139 static const double MIN_SUCCESS_PCT = .95;
142 static const double SUFFICIENT_FEETXS = 1;
145 static constexpr
double MIN_FEERATE = 10;
146 static const double MAX_FEERATE = 1e7;
147 static const double INF_FEERATE = MAX_MONEY;
149 static const double INF_PRIORITY = 1e9 * MAX_MONEY;
155 static const double FEE_SPACING = 1.1;
166 static constexpr
unsigned int SHORT_BLOCK_PERIODS = 12;
167 static constexpr
unsigned int SHORT_SCALE = 1;
169 static constexpr
unsigned int MED_BLOCK_PERIODS = 24;
170 static constexpr
unsigned int MED_SCALE = 2;
172 static constexpr
unsigned int LONG_BLOCK_PERIODS = 42;
173 static constexpr
unsigned int LONG_SCALE = 24;
175 static const unsigned int OLDEST_ESTIMATE_HISTORY = 6 * 1008;
178 static constexpr
double SHORT_DECAY = .962;
180 static constexpr
double MED_DECAY = .9952;
182 static constexpr
double LONG_DECAY = .99931;
185 static constexpr
double HALF_SUCCESS_PCT = .6;
187 static constexpr
double SUCCESS_PCT = .85;
189 static constexpr
double DOUBLE_SUCCESS_PCT = .95;
192 static constexpr
double SUFFICIENT_FEETXS = 0.1;
194 static constexpr
double SUFFICIENT_TXS_SHORT = 0.5;
203 static constexpr
double MIN_BUCKET_FEERATE = 1000;
204 static constexpr
double MAX_BUCKET_FEERATE = 1e7;
211 static constexpr
double FEE_SPACING = 1.05;
220 void processBlock(
unsigned int nBlockHeight,
221 std::vector<const CTxMemPoolEntry*>& entries);
224 bool processBlockTx(
unsigned int nBlockHeight,
const CTxMemPoolEntry* entry);
227 void processTransaction(
const CTxMemPoolEntry& entry,
bool validFeeEstimate);
230 bool removeTx(
uint256 hash,
bool inBlock);
233 CFeeRate estimateFee(
int confTarget)
const;
240 CFeeRate estimateSmartFee(
int confTarget,
int *answerFoundAtTarget,
const CTxMemPool& pool);
249 double estimatePriority(
int confTarget);
257 double estimateSmartPriority(
int confTarget,
int *answerFoundAtTarget,
const CTxMemPool& pool);
309 double estimateCombinedFee(
unsigned int confTarget,
double successThreshold,
bool checkShorterHorizon,
EstimationResult *result)
const;
311 double estimateConservativeFee(
unsigned int doubleTarget,
EstimationResult *result)
const;
313 unsigned int BlockSpan()
const;
315 unsigned int HistoricalBlockSpan()
const;
317 unsigned int MaxUsableEstimate()
const;
323 static constexpr
double MAX_FILTER_FEERATE = 1e7;
328 static constexpr
double FEE_FILTER_SPACING = 1.1;
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
unsigned int nBestSeenHeight
CFeeRate minTrackedFee
Passed to constructor to avoid dependency on main.
CTxMemPoolEntry stores data about the corresponding transaction, as well as data about all in-mempool...
TxConfirmStats * longStats
int64_t CAmount
Amount in lius (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
bool FeeModeFromString(const std::string &mode_string, FeeEstimateMode &fee_estimate_mode)
std::map< uint256, TxStatsInfo > mapMemPoolTxs
FastRandomContext insecure_rand
std::string StringForFeeReason(FeeReason reason)
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
unsigned int historicalBest
#define round(a, b, c, x, mul)
Fee rate in liu per kilobyte: CAmount / kB.
std::vector< double > buckets
Use default settings based on other criteria.
TxConfirmStats * shortStats
std::string StringForFeeEstimateHorizon(FeeEstimateHorizon horizon)
std::set< double > feeset
unsigned int untrackedTxs
Non-refcounted RAII wrapper for FILE*.
Wrapped boost mutex: supports recursive locking, but no waiting TODO: We should move away from using ...