Struct sc_transaction_pool::BasicPool
source · [−]pub struct BasicPool<PoolApi, Block> where
Block: BlockT,
PoolApi: ChainApi<Block = Block>, { /* private fields */ }
Expand description
Basic implementation of transaction pool that can be customized by providing PoolApi.
Implementations
sourceimpl<PoolApi, Block> BasicPool<PoolApi, Block> where
Block: BlockT,
PoolApi: ChainApi<Block = Block> + 'static,
impl<PoolApi, Block> BasicPool<PoolApi, Block> where
Block: BlockT,
PoolApi: ChainApi<Block = Block> + 'static,
sourcepub fn with_revalidation_type(
options: Options,
is_validator: IsValidator,
pool_api: Arc<PoolApi>,
prometheus: Option<&PrometheusRegistry>,
revalidation_type: RevalidationType,
spawner: impl SpawnNamed
) -> Self
pub fn with_revalidation_type(
options: Options,
is_validator: IsValidator,
pool_api: Arc<PoolApi>,
prometheus: Option<&PrometheusRegistry>,
revalidation_type: RevalidationType,
spawner: impl SpawnNamed
) -> Self
Create new basic transaction pool with provided api and custom revalidation type.
sourceimpl<Block, Client, Fetcher> BasicPool<LightChainApi<Client, Fetcher, Block>, Block> where
Block: BlockT,
Client: HeaderBackend<Block> + 'static,
Fetcher: Fetcher<Block> + 'static,
impl<Block, Client, Fetcher> BasicPool<LightChainApi<Client, Fetcher, Block>, Block> where
Block: BlockT,
Client: HeaderBackend<Block> + 'static,
Fetcher: Fetcher<Block> + 'static,
sourcepub fn new_light(
options: Options,
prometheus: Option<&PrometheusRegistry>,
spawner: impl SpawnNamed,
client: Arc<Client>,
fetcher: Arc<Fetcher>
) -> Self
pub fn new_light(
options: Options,
prometheus: Option<&PrometheusRegistry>,
spawner: impl SpawnNamed,
client: Arc<Client>,
fetcher: Arc<Fetcher>
) -> Self
Create new basic transaction pool for a light node with the provided api.
sourceimpl<Block, Client> BasicPool<FullChainApi<Client, Block>, Block> where
Block: BlockT,
Client: ProvideRuntimeApi<Block> + BlockBackend<Block> + BlockIdTo<Block>,
Client: ExecutorProvider<Block> + Send + Sync + 'static,
Client::Api: TaggedTransactionQueue<Block>,
ApiErrorFor<Client, Block>: Send + Display,
impl<Block, Client> BasicPool<FullChainApi<Client, Block>, Block> where
Block: BlockT,
Client: ProvideRuntimeApi<Block> + BlockBackend<Block> + BlockIdTo<Block>,
Client: ExecutorProvider<Block> + Send + Sync + 'static,
Client::Api: TaggedTransactionQueue<Block>,
ApiErrorFor<Client, Block>: Send + Display,
sourcepub fn new_full(
options: Options,
is_validator: IsValidator,
prometheus: Option<&PrometheusRegistry>,
spawner: impl SpawnNamed,
client: Arc<Client>
) -> Arc<Self>
pub fn new_full(
options: Options,
is_validator: IsValidator,
prometheus: Option<&PrometheusRegistry>,
spawner: impl SpawnNamed,
client: Arc<Client>
) -> Arc<Self>
Create new basic transaction pool for a full node with the provided api.
Trait Implementations
sourceimpl<Block, Client> LocalTransactionPool for BasicPool<FullChainApi<Client, Block>, Block> where
Block: BlockT,
Client: ProvideRuntimeApi<Block> + BlockBackend<Block> + BlockIdTo<Block>,
Client: Send + Sync + 'static,
Client::Api: TaggedTransactionQueue<Block>,
ApiErrorFor<Client, Block>: Send + Display,
impl<Block, Client> LocalTransactionPool for BasicPool<FullChainApi<Client, Block>, Block> where
Block: BlockT,
Client: ProvideRuntimeApi<Block> + BlockBackend<Block> + BlockIdTo<Block>,
Client: Send + Sync + 'static,
Client::Api: TaggedTransactionQueue<Block>,
ApiErrorFor<Client, Block>: Send + Display,
type Block = Block
type Block = Block
Block type.
type Hash = ExtrinsicHash<FullChainApi<Client, Block>>
type Hash = ExtrinsicHash<FullChainApi<Client, Block>>
Transaction hash type.
type Error = <FullChainApi<Client, Block> as ChainApi>::Error
type Error = <FullChainApi<Client, Block> as ChainApi>::Error
Error type.
sourcefn submit_local(
&self,
at: &BlockId<Self::Block>,
xt: LocalTransactionFor<Self>
) -> Result<Self::Hash, Self::Error>
fn submit_local(
&self,
at: &BlockId<Self::Block>,
xt: LocalTransactionFor<Self>
) -> Result<Self::Hash, Self::Error>
Submits the given local unverified transaction to the pool blocking the
current thread for any necessary pre-verification.
NOTE: It MUST NOT be used for transactions that originate from the
network or RPC, since the validation is performed with
TransactionSource::Local
. Read more
sourceimpl<PoolApi, Block> MaintainedTransactionPool for BasicPool<PoolApi, Block> where
Block: BlockT,
PoolApi: 'static + ChainApi<Block = Block>,
impl<PoolApi, Block> MaintainedTransactionPool for BasicPool<PoolApi, Block> where
Block: BlockT,
PoolApi: 'static + ChainApi<Block = Block>,
sourceimpl<PoolApi, Block> MallocSizeOf for BasicPool<PoolApi, Block> where
PoolApi: ChainApi<Block = Block>,
Block: BlockT,
impl<PoolApi, Block> MallocSizeOf for BasicPool<PoolApi, Block> where
PoolApi: ChainApi<Block = Block>,
Block: BlockT,
sourcefn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
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
sourcefn constant_size() -> Option<usize>
fn constant_size() -> Option<usize>
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
sourceimpl<PoolApi, Block> TransactionPool for BasicPool<PoolApi, Block> where
Block: BlockT,
PoolApi: 'static + ChainApi<Block = Block>,
impl<PoolApi, Block> TransactionPool for BasicPool<PoolApi, Block> where
Block: BlockT,
PoolApi: 'static + ChainApi<Block = Block>,
type Hash = ExtrinsicHash<PoolApi>
type Hash = ExtrinsicHash<PoolApi>
Transaction hash type.
type InPoolTransaction = Transaction<TxHash<Self>, TransactionFor<Self>>
type InPoolTransaction = Transaction<TxHash<Self>, TransactionFor<Self>>
In-pool transaction type.
sourcefn submit_at(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xts: Vec<TransactionFor<Self>>
) -> PoolFuture<Vec<Result<TxHash<Self>, Self::Error>>, Self::Error>
fn submit_at(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xts: Vec<TransactionFor<Self>>
) -> PoolFuture<Vec<Result<TxHash<Self>, Self::Error>>, Self::Error>
Returns a future that imports a bunch of unverified transactions to the pool.
sourcefn submit_one(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xt: TransactionFor<Self>
) -> PoolFuture<TxHash<Self>, Self::Error>
fn submit_one(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xt: TransactionFor<Self>
) -> PoolFuture<TxHash<Self>, Self::Error>
Returns a future that imports one unverified transaction to the pool.
sourcefn submit_and_watch(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xt: TransactionFor<Self>
) -> PoolFuture<Box<TransactionStatusStreamFor<Self>>, Self::Error>
fn submit_and_watch(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xt: TransactionFor<Self>
) -> PoolFuture<Box<TransactionStatusStreamFor<Self>>, Self::Error>
Returns a future that import a single transaction and starts to watch their progress in the pool.
sourcefn remove_invalid(
&self,
hashes: &[TxHash<Self>]
) -> Vec<Arc<Self::InPoolTransaction>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn remove_invalid(
&self,
hashes: &[TxHash<Self>]
) -> Vec<Arc<Self::InPoolTransaction>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Remove transactions identified by given hashes (and dependent transactions) from the pool.
sourcefn status(&self) -> PoolStatus
fn status(&self) -> PoolStatus
Returns pool status.
sourcefn import_notification_stream(&self) -> ImportNotificationStream<TxHash<Self>>
fn import_notification_stream(&self) -> ImportNotificationStream<TxHash<Self>>
Return an event stream of transactions imported to the pool.
sourcefn hash_of(&self, xt: &TransactionFor<Self>) -> TxHash<Self>
fn hash_of(&self, xt: &TransactionFor<Self>) -> TxHash<Self>
Returns transaction hash
sourcefn on_broadcasted(&self, propagations: HashMap<TxHash<Self>, Vec<String>>)
fn on_broadcasted(&self, propagations: HashMap<TxHash<Self>, Vec<String>>)
Notify the pool about transactions broadcast.
sourcefn ready_transaction(
&self,
hash: &TxHash<Self>
) -> Option<Arc<Self::InPoolTransaction>>
fn ready_transaction(
&self,
hash: &TxHash<Self>
) -> Option<Arc<Self::InPoolTransaction>>
Return specific ready transaction by hash, if there is one.
sourcefn ready_at(
&self,
at: NumberFor<Self::Block>
) -> Pin<Box<dyn Future<Output = Box<dyn Iterator<Item = Arc<Transaction<ExtrinsicHash<PoolApi>, ExtrinsicFor<PoolApi>>>> + Send>> + Send>>
fn ready_at(
&self,
at: NumberFor<Self::Block>
) -> Pin<Box<dyn Future<Output = Box<dyn Iterator<Item = Arc<Transaction<ExtrinsicHash<PoolApi>, ExtrinsicFor<PoolApi>>>> + Send>> + Send>>
Get an iterator for ready transactions ordered by priority. Read more
sourcefn ready(
&self
) -> Box<dyn Iterator<Item = Arc<Transaction<ExtrinsicHash<PoolApi>, ExtrinsicFor<PoolApi>>>> + Send>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
fn ready(
&self
) -> Box<dyn Iterator<Item = Arc<Transaction<ExtrinsicHash<PoolApi>, ExtrinsicFor<PoolApi>>>> + Send>ⓘNotable traits for Box<R, Global>impl<R> Read for Box<R, Global> where
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
R: Read + ?Sized, impl<W> Write for Box<W, Global> where
W: Write + ?Sized, impl<I, A> Iterator for Box<I, A> where
I: Iterator + ?Sized,
A: Allocator, type Item = <I as Iterator>::Item;impl<F, A> Future for Box<F, A> where
F: Future + Unpin + ?Sized,
A: Allocator + 'static, type Output = <F as Future>::Output;
Get an iterator for ready transactions ordered by priority.
Auto Trait Implementations
impl<PoolApi, Block> !RefUnwindSafe for BasicPool<PoolApi, Block>
impl<PoolApi, Block> Send for BasicPool<PoolApi, Block>
impl<PoolApi, Block> Sync for BasicPool<PoolApi, Block>
impl<PoolApi, Block> Unpin for BasicPool<PoolApi, Block>
impl<PoolApi, Block> !UnwindSafe for BasicPool<PoolApi, Block>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedConversion for T
impl<T> CheckedConversion for T
sourcefn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Convert from a value of T
into an equivalent instance of Option<Self>
. Read more
sourcefn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
sourceimpl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
impl<T> MallocSizeOfExt for T where
T: MallocSizeOf,
sourcefn malloc_size_of(&self) -> usize
fn malloc_size_of(&self) -> usize
Method to launch a heapsize measurement with a fresh state. Read more
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
sourcefn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
sourcefn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcepub fn unchecked_into(self) -> T
pub fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
sourceimpl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
sourcepub fn unique_saturated_into(self) -> T
pub fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more