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

source

pub fn new(config: TxPoolConfig, snapshot: Arc<Snapshot>) -> TxPool

Create new TxPool

source

pub fn snapshot(&self) -> &Snapshot

Tx-pool owned snapshot, it may not consistent with chain cause tx-pool update snapshot asynchronously

source

pub fn cloned_snapshot(&self) -> Arc<Snapshot>

Makes a clone of the Arc

source

pub fn reach_size_limit(&self, tx_size: usize) -> bool

Whether Tx-pool reach size limit

source

pub fn reach_cycles_limit(&self, cycles: Cycle) -> bool

Whether Tx-pool reach cycles limit

source

pub fn update_statics_for_add_tx(&mut self, tx_size: usize, cycles: Cycle)

Update size and cycles statics for add tx

source

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

source

pub fn add_pending(&mut self, entry: TxEntry) -> bool

Add tx to pending pool If did have this value present, false is returned.

source

pub fn add_gap(&mut self, entry: TxEntry) -> bool

Add tx which proposed but still uncommittable to gap pool

source

pub fn add_proposed(&mut self, entry: TxEntry) -> Result<bool, Reject>

Add tx to proposed pool

source

pub fn contains_proposal_id(&self, id: &ProposalShortId) -> bool

Returns true if the tx-pool contains a tx with specified id.

source

pub fn get_tx_with_cycles( &self, id: &ProposalShortId ) -> Option<(TransactionView, Cycle)>

Returns tx with cycles corresponding to the id.

source

pub fn get_tx(&self, id: &ProposalShortId) -> Option<&TransactionView>

Returns tx corresponding to the id.

source

pub fn get_entry_from_pending_or_gap( &self, id: &ProposalShortId ) -> Option<&TxEntry>

Returns tx from pending and gap corresponding to the id. RPC

source

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.

source

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsAny for Twhere T: Any,

§

fn as_any(&self) -> &(dyn Any + 'static)

TODO(doc): @quake
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more