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§
source§impl TxPool
impl 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 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_entry_from_pending_or_gap(
&self,
id: &ProposalShortId
) -> Option<&TxEntry>
pub fn get_entry_from_pending_or_gap( &self, id: &ProposalShortId ) -> Option<&TxEntry>
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.