pub struct BasePool<Hash: Hash + Eq, Ex> { /* private fields */ }
Expand description

Transaction pool.

Builds a dependency graph for all transactions in the pool and returns the ones that are currently ready to be executed.

General note: If function returns some transactions it usually means that importing them as-is for the second time will fail or produce unwanted results. Most likely it is required to revalidate them and recompute set of required tags.

Implementations

Create new pool given reject_future_transactions flag.

Returns if the transaction for the given hash is already imported.

Imports transaction to the pool.

The pool consists of two parts: Future and Ready. The former contains transactions that require some tags that are not yet provided by other transactions in the pool. The latter contains transactions that have all the requirements satisfied and are ready to be included in the block.

Returns an iterator over ready transactions in the pool.

Returns an iterator over future transactions in the pool.

Returns pool transactions given list of hashes.

Includes both ready and future pool. For every hash in the hashes iterator an Option is produced (so the resulting Vec always have the same length).

Returns pool transaction by hash.

Makes sure that the transactions in the queues stay within provided limits.

Removes and returns worst transactions from the queues and all transactions that depend on them. Technically the worst transaction should be evaluated by computing the entire pending set. We use a simplified approach to remove the transaction that occupies the pool for the longest time.

Removes all transactions represented by the hashes and all other transactions that depend on them.

Returns a list of actually removed transactions. NOTE some transactions might still be valid, but were just removed because they were part of a chain, you may attempt to re-import them later. NOTE If you want to remove ready transactions that were already used and you don’t want them to be stored in the pool use prune_tags method.

Removes and returns all transactions from the future queue.

Prunes transactions that provide given list of tags.

This will cause all transactions that provide these tags to be removed from the pool, but unlike remove_subtree, dependent transactions are not touched. Additional transactions from future queue might be promoted to ready if you satisfy tags that the pool didn’t previously know about.

Get pool status.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Measure the heap usage of all descendant heap-allocated structures, but not the space taken up by the value itself. If T::size_of is a constant, consider implementing constant_size as well. Read more

Used to optimize MallocSizeOf implementation for collections like Vec and HashMap to avoid iterating over them unnecessarily. The Self: Sized bound is for object safety. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert from a value of T into an equivalent instance of Option<Self>. Read more

Consume self to return Some equivalent value of Option<T>. Read more

Returns the argument unchanged.

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

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

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

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

Calls U::from(self).

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

Get a reference to the inner from the outer.

Get a mutable reference to the inner from the outer.

Method to launch a heapsize measurement with a fresh state. Read more

Should always be Self

Convert from a value of T into an equivalent instance of Self. Read more

Consume self to return an equivalent value of T. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The counterpart to unchecked_from.

Consume self to return an equivalent value of T.

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

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