[][src]Struct substrate_service::TransactionPool

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

Extrinsics pool that performs validation.

Methods

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

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

Create a new transaction pool.

pub fn submit_at<T>(
    &self,
    at: &BlockId<<B as ChainApi>::Block>,
    xts: T,
    force: bool
) -> impl Future<Output = Result<Vec<Result<<B as ChainApi>::Hash, <B as ChainApi>::Error>>, <B as ChainApi>::Error>> where
    T: IntoIterator<Item = <<B as ChainApi>::Block as Block>::Extrinsic>, 
[src]

Imports a bunch of unverified extrinsics to the pool

pub fn submit_one(
    &self,
    at: &BlockId<<B as ChainApi>::Block>,
    xt: <<B as ChainApi>::Block as Block>::Extrinsic
) -> impl Future<Output = Result<<B as ChainApi>::Hash, <B as ChainApi>::Error>>
[src]

Imports one unverified extrinsic to the pool

pub fn submit_and_watch(
    &self,
    at: &BlockId<<B as ChainApi>::Block>,
    xt: <<B as ChainApi>::Block as Block>::Extrinsic
) -> impl Future<Output = Result<Watcher<<B as ChainApi>::Hash, <<B as ChainApi>::Block as Block>::Hash>, <B as ChainApi>::Error>>
[src]

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

pub fn prune(
    &self,
    at: &BlockId<<B as ChainApi>::Block>,
    parent: &BlockId<<B as ChainApi>::Block>,
    extrinsics: &[<<B as ChainApi>::Block as Block>::Extrinsic]
) -> impl Future<Output = Result<(), <B as ChainApi>::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 as ChainApi>::Block>,
    tags: impl IntoIterator<Item = Vec<u8>>,
    known_imported_hashes: impl Clone + IntoIterator<Item = <B as ChainApi>::Hash>
) -> impl Future<Output = Result<(), <B as ChainApi>::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.

Returns transactions that have been removed from the pool and must be reverified before reinserting to the pool.

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 import_notification_stream(&self) -> UnboundedReceiver<()>[src]

Return an event stream of transactions imported to the pool.

pub fn on_broadcasted(
    &self,
    propagated: HashMap<<B as ChainApi>::Hash, Vec<String>, RandomState>
)
[src]

Invoked when extrinsics are broadcasted.

pub fn remove_invalid(
    &self,
    hashes: &[<B as ChainApi>::Hash]
) -> Vec<Arc<Transaction<<B as ChainApi>::Hash, <<B as ChainApi>::Block as Block>::Extrinsic>>>
[src]

Remove from the pool.

pub fn ready(
    &self
) -> impl Iterator<Item = Arc<Transaction<<B as ChainApi>::Hash, <<B as ChainApi>::Block as Block>::Extrinsic>>>
[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: &<<B as ChainApi>::Block as Block>::Extrinsic
) -> <B as ChainApi>::Hash
[src]

Returns transaction hash

Trait Implementations

impl<B> Clone for Pool<B> where
    B: ChainApi
[src]

Auto Trait Implementations

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> 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> Unpin for Pool<B>

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<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> CheckedConversion for T[src]

impl<T> SaturatedConversion for T[src]

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

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> Typeable for T where
    T: Any
[src]