![]() |
Bitcoin Core 30.99.0
P2P Digital Currency
|
We will instantiate an instance of this class to track transactions that were included in a block. More...
Public Member Functions | |
| TxConfirmStats (const std::vector< double > &defaultBuckets, const std::map< double, unsigned int > &defaultBucketMap, unsigned int maxPeriods, double decay, unsigned int scale) | |
| Create new TxConfirmStats. More... | |
| void | ClearCurrent (unsigned int nBlockHeight) |
| Roll the circular buffer for unconfirmed txs. More... | |
| void | Record (int blocksToConfirm, double val) |
| Record a new transaction data point in the current block stats. More... | |
| unsigned int | NewTx (unsigned int nBlockHeight, double val) |
| Record a new transaction entering the mempool. More... | |
| void | removeTx (unsigned int entryHeight, unsigned int nBestSeenHeight, unsigned int bucketIndex, bool inBlock) |
| Remove a transaction from mempool tracking stats. More... | |
| void | UpdateMovingAverages () |
| Update our estimates by decaying our historical moving average and updating with the data gathered from the current block. More... | |
| double | EstimateMedianVal (int confTarget, double sufficientTxVal, double minSuccess, unsigned int nBlockHeight, EstimationResult *result=nullptr) const |
| Calculate a feerate estimate. More... | |
| unsigned int | GetMaxConfirms () const |
| Return the max number of confirms we're tracking. More... | |
| void | Write (AutoFile &fileout) const |
| Write state of estimation data to a file. More... | |
| void | Read (AutoFile &filein, size_t numBuckets) |
| Read saved state of estimation data from a file and replace all internal data structures and variables with this state. More... | |
Private Member Functions | |
| void | resizeInMemoryCounters (size_t newbuckets) |
Private Attributes | |
| const std::vector< double > & | buckets |
| const std::map< double, unsigned int > & | bucketMap |
| std::vector< double > | txCtAvg |
| std::vector< std::vector< double > > | confAvg |
| std::vector< std::vector< double > > | failAvg |
| std::vector< double > | m_feerate_avg |
| double | decay |
| unsigned int | scale |
| std::vector< std::vector< int > > | unconfTxs |
| std::vector< int > | oldUnconfTxs |
We will instantiate an instance of this class to track transactions that were included in a block.
We will lump transactions into a bucket according to their approximate feerate and then track how long it took for those txs to be included in a block
The tracking of unconfirmed (mempool) transactions is completely independent of the historical tracking of transactions that have been confirmed in a block.
Definition at line 78 of file block_policy_estimator.cpp.
| TxConfirmStats::TxConfirmStats | ( | const std::vector< double > & | defaultBuckets, |
| const std::map< double, unsigned int > & | defaultBucketMap, | ||
| unsigned int | maxPeriods, | ||
| double | decay, | ||
| unsigned int | scale | ||
| ) |
Create new TxConfirmStats.
This is called by BlockPolicyEstimator's constructor with default values.
| defaultBuckets | contains the upper limits for the bucket boundaries |
| maxPeriods | max number of periods to track |
| decay | how much to decay the historical moving average per block |
Definition at line 179 of file block_policy_estimator.cpp.
| void TxConfirmStats::ClearCurrent | ( | unsigned int | nBlockHeight | ) |
Roll the circular buffer for unconfirmed txs.
Definition at line 208 of file block_policy_estimator.cpp.
| double TxConfirmStats::EstimateMedianVal | ( | int | confTarget, |
| double | sufficientTxVal, | ||
| double | minSuccess, | ||
| unsigned int | nBlockHeight, | ||
| EstimationResult * | result = nullptr |
||
| ) | const |
Calculate a feerate estimate.
Find the lowest value bucket (or range of buckets to make sure we have enough data points) whose transactions still have sufficient likelihood of being confirmed within the target number of confirmations
| confTarget | target number of confirmations |
| sufficientTxVal | required average number of transactions per block in a bucket range |
| minSuccess | the success probability we require |
| nBlockHeight | the current block height |
Definition at line 245 of file block_policy_estimator.cpp.
|
inline |
Return the max number of confirms we're tracking.
Definition at line 166 of file block_policy_estimator.cpp.
| unsigned int TxConfirmStats::NewTx | ( | unsigned int | nBlockHeight, |
| double | val | ||
| ) |
Record a new transaction entering the mempool.
Definition at line 477 of file block_policy_estimator.cpp.
| void TxConfirmStats::Read | ( | AutoFile & | filein, |
| size_t | numBuckets | ||
| ) |
Read saved state of estimation data from a file and replace all internal data structures and variables with this state.
Definition at line 421 of file block_policy_estimator.cpp.
| void TxConfirmStats::Record | ( | int | blocksToConfirm, |
| double | val | ||
| ) |
Record a new transaction data point in the current block stats.
| blocksToConfirm | the number of blocks it took this transaction to confirm |
| val | the feerate of the transaction |
Definition at line 217 of file block_policy_estimator.cpp.
| void TxConfirmStats::removeTx | ( | unsigned int | entryHeight, |
| unsigned int | nBestSeenHeight, | ||
| unsigned int | bucketIndex, | ||
| bool | inBlock | ||
| ) |
Remove a transaction from mempool tracking stats.
Definition at line 485 of file block_policy_estimator.cpp.
|
private |
Definition at line 198 of file block_policy_estimator.cpp.
| void TxConfirmStats::UpdateMovingAverages | ( | ) |
Update our estimates by decaying our historical moving average and updating with the data gathered from the current block.
Definition at line 231 of file block_policy_estimator.cpp.
| void TxConfirmStats::Write | ( | AutoFile & | fileout | ) | const |
Write state of estimation data to a file.
Definition at line 411 of file block_policy_estimator.cpp.
|
private |
Definition at line 83 of file block_policy_estimator.cpp.
|
private |
Definition at line 82 of file block_policy_estimator.cpp.
|
private |
Definition at line 92 of file block_policy_estimator.cpp.
|
private |
Definition at line 105 of file block_policy_estimator.cpp.
|
private |
Definition at line 96 of file block_policy_estimator.cpp.
|
private |
Definition at line 100 of file block_policy_estimator.cpp.
|
private |
Definition at line 115 of file block_policy_estimator.cpp.
|
private |
Definition at line 108 of file block_policy_estimator.cpp.
|
private |
Definition at line 88 of file block_policy_estimator.cpp.
|
private |
Definition at line 113 of file block_policy_estimator.cpp.