[][src]Struct substrate_transaction_graph::Pool

pub struct Pool<B: ChainApi> { /* fields omitted */ }

Extrinsics pool.

Methods

impl<B: ChainApi> Pool<B>[src]

pub fn submit_at<T>(
    &self,
    at: &BlockId<B::Block>,
    xts: T,
    force: bool
) -> Result<Vec<Result<ExHash<B>, B::Error>>, B::Error> where
    T: IntoIterator<Item = ExtrinsicFor<B>>, 
[src]

Imports a bunch of unverified extrinsics to the pool

pub fn submit_one(
    &self,
    at: &BlockId<B::Block>,
    xt: ExtrinsicFor<B>
) -> Result<ExHash<B>, B::Error>
[src]

Imports one unverified extrinsic to the pool

pub fn submit_and_watch(
    &self,
    at: &BlockId<B::Block>,
    xt: ExtrinsicFor<B>
) -> Result<Watcher<ExHash<B>, BlockHash<B>>, B::Error>
[src]

Import a single extrinsic and starts to watch their progress in the pool.

pub fn prune(
    &self,
    at: &BlockId<B::Block>,
    parent: &BlockId<B::Block>,
    extrinsics: &[ExtrinsicFor<B>]
) -> Result<(), B::Error>
[src]

Prunes ready transactions.

Used to clear the pool from transactions that were part of recently imported block. To perform pruning we need the tags that each extrinsic provides and to avoid calling into runtime too often we first lookup all extrinsics that are in the pool and get their provided tags from there. Otherwise we query the runtime at the parent block.

pub fn prune_tags(
    &self,
    at: &BlockId<B::Block>,
    tags: impl IntoIterator<Item = Tag>,
    known_imported_hashes: impl IntoIterator<Item = ExHash<B>> + Clone
) -> Result<(), B::Error>
[src]

Prunes ready transactions that provide given list of tags.

Given tags are assumed to be always provided now, so all transactions in the Future Queue that require that particular tag (and have other requirements satisfied) are promoted to Ready Queue.

Moreover for each provided tag we remove transactions in the pool that:

  1. Provide that tag directly
  2. Are a dependency of pruned transaction.

By removing predecessor transactions as well we might actually end up pruning too much, so all removed transactions are reverified against the runtime (validate_transaction) to make sure they are invalid.

However we avoid revalidating transactions that are contained within the second parameter of known_imported_hashes. These transactions (if pruned) are not revalidated and become temporarily banned to prevent importing them in the (near) future.

pub fn clear_stale(&self, at: &BlockId<B::Block>) -> Result<(), B::Error>[src]

Removes stale transactions from the pool.

Stale transactions are transaction beyond their longevity period. Note this function does not remove transactions that are already included in the chain. See prune_tags if you want this.

pub fn new(options: Options, api: B) -> Self[src]

Create a new transaction pool.

pub fn import_notification_stream(&self) -> EventStream[src]

Return an event stream of transactions imported to the pool.

pub fn on_broadcasted(&self, propagated: HashMap<ExHash<B>, Vec<String>>)[src]

Invoked when extrinsics are broadcasted.

pub fn remove_invalid(&self, hashes: &[ExHash<B>]) -> Vec<TransactionFor<B>>[src]

Remove from the pool.

pub fn ready(&self) -> impl Iterator<Item = TransactionFor<B>>[src]

Get an iterator for ready transactions ordered by priority

pub fn status(&self) -> Status[src]

Returns pool status.

pub fn hash_of(&self, xt: &ExtrinsicFor<B>) -> ExHash<B>[src]

Returns transaction hash

Auto Trait Implementations

impl<B> Unpin for Pool<B> where
    B: Unpin,
    <B as ChainApi>::Block: Block,
    <B as ChainApi>::Hash: Unpin

impl<B> Sync for Pool<B> where
    <B as ChainApi>::Block: Block,
    <<B as ChainApi>::Block as Block>::Extrinsic: Send + Sync,
    <B as ChainApi>::Hash: Send + Sync,
    <<B as ChainApi>::Block as Block>::Hash: Send

impl<B> Send for Pool<B> where
    <B as ChainApi>::Block: Block,
    <<B as ChainApi>::Block as Block>::Extrinsic: Send + Sync,
    <B as ChainApi>::Hash: Send + Sync,
    <<B as ChainApi>::Block as Block>::Hash: Send

impl<B> !UnwindSafe for Pool<B>

impl<B> !RefUnwindSafe for Pool<B>

Blanket Implementations

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

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

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.

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

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

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

impl<S, T> UncheckedInto<T> for S where
    T: UncheckedFrom<S>, 
[src]

impl<T, Outer> IsWrappedBy<Outer> for T where
    Outer: AsRef<T> + AsMut<T> + From<T>,
    T: From<Outer>, 
[src]

fn from_ref(outer: &Outer) -> &T[src]

Get a reference to the inner from the outer.

fn from_mut(outer: &mut Outer) -> &mut T[src]

Get a mutable reference to the inner from the outer.

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

type Output = T

Should always be Self

impl<T> Erased for T[src]

impl<T, S> UniqueSaturatedInto<T> for S where
    S: TryInto<T>,
    T: Bounded
[src]

impl<T> SaturatedConversion for T[src]

impl<T> CheckedConversion for T[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]