Struct ckb_tx_pool::pool::TxPool
source · [−]pub struct TxPool {
pub recent_reject: Option<RecentReject>,
/* private fields */
}Expand description
Tx-pool implementation
Fields
recent_reject: Option<RecentReject>record recent reject
Implementations
sourceimpl TxPool
impl TxPool
sourcepub fn new(
config: TxPoolConfig,
snapshot: Arc<Snapshot>,
last_txs_updated_at: Arc<AtomicU64>
) -> TxPool
pub fn new(
config: TxPoolConfig,
snapshot: Arc<Snapshot>,
last_txs_updated_at: Arc<AtomicU64>
) -> TxPool
Create new TxPool
sourcepub fn snapshot(&self) -> &Snapshot
pub fn snapshot(&self) -> &Snapshot
Tx-pool owned snapshot, it may not consistent with chain cause tx-pool update snapshot asynchronously
sourcepub fn cloned_snapshot(&self) -> Arc<Snapshot>
pub fn cloned_snapshot(&self) -> Arc<Snapshot>
Makes a clone of the Arc
sourcepub fn reach_size_limit(&self, tx_size: usize) -> bool
pub fn reach_size_limit(&self, tx_size: usize) -> bool
Whether Tx-pool reach size limit
sourcepub fn reach_cycles_limit(&self, cycles: Cycle) -> bool
pub fn reach_cycles_limit(&self, cycles: Cycle) -> bool
Whether Tx-pool reach cycles limit
sourcepub fn update_statics_for_add_tx(&mut self, tx_size: usize, cycles: Cycle)
pub fn update_statics_for_add_tx(&mut self, tx_size: usize, cycles: Cycle)
Update size and cycles statics for add tx
sourcepub fn update_statics_for_remove_tx(&mut self, tx_size: usize, cycles: Cycle)
pub fn update_statics_for_remove_tx(&mut self, tx_size: usize, cycles: Cycle)
Update size and cycles statics for remove tx cycles overflow is possible, currently obtaining cycles is not accurate
sourcepub fn add_pending(&mut self, entry: TxEntry) -> bool
pub fn add_pending(&mut self, entry: TxEntry) -> bool
Add tx to pending pool If did have this value present, false is returned.
sourcepub fn add_gap(&mut self, entry: TxEntry) -> bool
pub fn add_gap(&mut self, entry: TxEntry) -> bool
Add tx which proposed but still uncommittable to gap pool
sourcepub fn get_last_txs_updated_at(&self) -> u64
pub fn get_last_txs_updated_at(&self) -> u64
Get last txs in tx-pool update timestamp
sourcepub fn contains_proposal_id(&self, id: &ProposalShortId) -> bool
pub fn contains_proposal_id(&self, id: &ProposalShortId) -> bool
Returns true if the tx-pool contains a tx with specified id.
sourcepub fn get_tx_with_cycles(
&self,
id: &ProposalShortId
) -> Option<(TransactionView, Cycle)>
pub fn get_tx_with_cycles(
&self,
id: &ProposalShortId
) -> Option<(TransactionView, Cycle)>
Returns tx with cycles corresponding to the id.
sourcepub fn get_tx(&self, id: &ProposalShortId) -> Option<&TransactionView>
pub fn get_tx(&self, id: &ProposalShortId) -> Option<&TransactionView>
Returns tx corresponding to the id.
sourcepub fn get_tx_from_pending_or_else_gap(
&self,
id: &ProposalShortId
) -> Option<&TransactionView>
pub fn get_tx_from_pending_or_else_gap(
&self,
id: &ProposalShortId
) -> Option<&TransactionView>
Returns tx from pending and gap corresponding to the id. RPC
sourcepub fn get_proposals(
&self,
limit: usize,
exclusion: &HashSet<ProposalShortId>
) -> HashSet<ProposalShortId>
pub fn get_proposals(
&self,
limit: usize,
exclusion: &HashSet<ProposalShortId>
) -> HashSet<ProposalShortId>
Get to-be-proposal transactions that may be included in the next block.
sourcepub fn get_tx_from_pool_or_store(
&self,
proposal_id: &ProposalShortId
) -> Option<TransactionView>
pub fn get_tx_from_pool_or_store(
&self,
proposal_id: &ProposalShortId
) -> Option<TransactionView>
Returns tx from tx-pool or storage corresponding to the id.
Auto Trait Implementations
impl !RefUnwindSafe for TxPool
impl Send for TxPool
impl Sync for TxPool
impl Unpin for TxPool
impl !UnwindSafe for TxPool
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more