[][src]Struct ckb_fee_estimator::Estimator

pub struct Estimator { /* fields omitted */ }

Fee Estimator Estimator track new block and tx_pool to collect data we track every new tx enter txpool and record the tip height and fee_rate, when tx is packed into a new block or dropped by txpool, we get a sample about how long a tx with X fee_rate can get confirmed or get dropped.

In inner, we group samples by predefined fee_rate buckets. To estimator fee_rate for a confirm target(how many blocks that a tx can get committed), we travel through fee_rate buckets, try to find a fee_rate X to let a tx get committed with high probilities within confirm target blocks.

Implementations

impl Estimator[src]

pub fn new() -> Self[src]

pub fn process_block(&mut self, height: u64, txs: impl Iterator<Item = Byte32>)[src]

process new block record confirm blocks for txs which we tracked before.

pub fn track_tx(&mut self, tx_hash: Byte32, fee_rate: FeeRate, height: u64)[src]

track a tx that entered txpool

pub fn drop_tx(&mut self, tx_hash: &Byte32) -> bool[src]

tx removed from txpool

pub fn estimate(&self, expect_confirm_blocks: usize) -> FeeRate[src]

estimate a fee rate for confirm target

Trait Implementations

impl Clone for Estimator[src]

impl Default for Estimator[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.