Trait sc_service::TransactionPool
source · [−]pub trait TransactionPool: Send + Sync {
type Block: Block;
type Hash: Hash + Eq + Member + Serialize;
type InPoolTransaction: InPoolTransaction;
type Error: From<Error> + IntoPoolError;
fn submit_at(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xts: Vec<<Self::Block as Block>::Extrinsic, Global>
) -> Pin<Box<dyn Future<Output = Result<Vec<Result<Self::Hash, Self::Error>, Global>, Self::Error>> + Send + 'static, Global>>;
fn submit_one(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xt: <Self::Block as Block>::Extrinsic
) -> Pin<Box<dyn Future<Output = Result<Self::Hash, Self::Error>> + Send + 'static, Global>>;
fn submit_and_watch(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xt: <Self::Block as Block>::Extrinsic
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = TransactionStatus<Self::Hash, <Self::Block as Block>::Hash>> + Unpin + Send + 'static, Global>, Self::Error>> + Send + 'static, Global>>;
fn ready_at(
&self,
at: <<Self::Block as Block>::Header as Header>::Number
) -> Pin<Box<dyn Future<Output = Box<dyn Iterator<Item = Arc<Self::InPoolTransaction>> + Send + 'static, Global>> + Send + 'static, Global>>;
fn ready(
&self
) -> Box<dyn Iterator<Item = Arc<Self::InPoolTransaction>> + Send + 'static, Global>ⓘ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 remove_invalid(
&self,
hashes: &[Self::Hash]
) -> Vec<Arc<Self::InPoolTransaction>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
;
fn status(&self) -> PoolStatus;
fn import_notification_stream(&self) -> Receiver<Self::Hash>;
fn on_broadcasted(
&self,
propagations: HashMap<Self::Hash, Vec<String, Global>, RandomState>
);
fn hash_of(&self, xt: &<Self::Block as Block>::Extrinsic) -> Self::Hash;
fn ready_transaction(
&self,
hash: &Self::Hash
) -> Option<Arc<Self::InPoolTransaction>>;
}
Expand description
Transaction pool interface.
Associated Types
In-pool transaction type.
type Error: From<Error> + IntoPoolError
type Error: From<Error> + IntoPoolError
Error type.
Required methods
Returns a future that imports a bunch of unverified transactions to the pool.
Returns a future that imports one unverified transaction to the pool.
fn submit_and_watch(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xt: <Self::Block as Block>::Extrinsic
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = TransactionStatus<Self::Hash, <Self::Block as Block>::Hash>> + Unpin + Send + 'static, Global>, Self::Error>> + Send + 'static, Global>>
fn submit_and_watch(
&self,
at: &BlockId<Self::Block>,
source: TransactionSource,
xt: <Self::Block as Block>::Extrinsic
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = TransactionStatus<Self::Hash, <Self::Block as Block>::Hash>> + Unpin + Send + 'static, Global>, Self::Error>> + Send + 'static, Global>>
Returns a future that import a single transaction and starts to watch their progress in the pool.
Get an iterator for ready transactions ordered by priority.
Guarantees to return only when transaction pool got updated at at
block.
Guarantees to return immediately when None
is passed.
fn ready(
&self
) -> Box<dyn Iterator<Item = Arc<Self::InPoolTransaction>> + Send + 'static, Global>ⓘ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<Self::InPoolTransaction>> + Send + 'static, Global>ⓘ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.
Remove transactions identified by given hashes (and dependent transactions) from the pool.
fn status(&self) -> PoolStatus
fn status(&self) -> PoolStatus
Returns pool status.
fn import_notification_stream(&self) -> Receiver<Self::Hash>
fn import_notification_stream(&self) -> Receiver<Self::Hash>
Return an event stream of transactions imported to the pool.
fn on_broadcasted(
&self,
propagations: HashMap<Self::Hash, Vec<String, Global>, RandomState>
)
fn on_broadcasted(
&self,
propagations: HashMap<Self::Hash, Vec<String, Global>, RandomState>
)
Notify the pool about transactions broadcast.
Returns transaction hash
fn ready_transaction(
&self,
hash: &Self::Hash
) -> Option<Arc<Self::InPoolTransaction>>
fn ready_transaction(
&self,
hash: &Self::Hash
) -> Option<Arc<Self::InPoolTransaction>>
Return specific ready transaction by hash, if there is one.
Implementations on Foreign Types
sourceimpl<PoolApi, Block> TransactionPool for BasicPool<PoolApi, Block> where
Block: Block,
PoolApi: 'static + ChainApi<Block = Block>,
impl<PoolApi, Block> TransactionPool for BasicPool<PoolApi, Block> where
Block: Block,
PoolApi: 'static + ChainApi<Block = Block>,
type Block = <PoolApi as ChainApi>::Block
type Hash = <<PoolApi as ChainApi>::Block as Block>::Hash
type InPoolTransaction = Transaction<<BasicPool<PoolApi, Block> as TransactionPool>::Hash, <<BasicPool<PoolApi, Block> as TransactionPool>::Block as Block>::Extrinsic>
type Error = <PoolApi as ChainApi>::Error
pub fn submit_at(
&self,
at: &BlockId<<BasicPool<PoolApi, Block> as TransactionPool>::Block>,
source: TransactionSource,
xts: Vec<<<BasicPool<PoolApi, Block> as TransactionPool>::Block as Block>::Extrinsic, Global>
) -> Pin<Box<dyn Future<Output = Result<Vec<Result<<BasicPool<PoolApi, Block> as TransactionPool>::Hash, <BasicPool<PoolApi, Block> as TransactionPool>::Error>, Global>, <BasicPool<PoolApi, Block> as TransactionPool>::Error>> + Send + 'static, Global>>
pub fn submit_one(
&self,
at: &BlockId<<BasicPool<PoolApi, Block> as TransactionPool>::Block>,
source: TransactionSource,
xt: <<BasicPool<PoolApi, Block> as TransactionPool>::Block as Block>::Extrinsic
) -> Pin<Box<dyn Future<Output = Result<<BasicPool<PoolApi, Block> as TransactionPool>::Hash, <BasicPool<PoolApi, Block> as TransactionPool>::Error>> + Send + 'static, Global>>
pub fn submit_and_watch(
&self,
at: &BlockId<<BasicPool<PoolApi, Block> as TransactionPool>::Block>,
source: TransactionSource,
xt: <<BasicPool<PoolApi, Block> as TransactionPool>::Block as Block>::Extrinsic
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = TransactionStatus<<BasicPool<PoolApi, Block> as TransactionPool>::Hash, <<BasicPool<PoolApi, Block> as TransactionPool>::Block as Block>::Hash>> + Unpin + Send + 'static, Global>, <BasicPool<PoolApi, Block> as TransactionPool>::Error>> + Send + 'static, Global>>
pub fn remove_invalid(
&self,
hashes: &[<BasicPool<PoolApi, Block> as TransactionPool>::Hash]
) -> Vec<Arc<<BasicPool<PoolApi, Block> as TransactionPool>::InPoolTransaction>, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn status(&self) -> PoolStatus
pub fn import_notification_stream(
&self
) -> Receiver<<BasicPool<PoolApi, Block> as TransactionPool>::Hash>
pub fn hash_of(
&self,
xt: &<<BasicPool<PoolApi, Block> as TransactionPool>::Block as Block>::Extrinsic
) -> <BasicPool<PoolApi, Block> as TransactionPool>::Hash
pub fn on_broadcasted(
&self,
propagations: HashMap<<BasicPool<PoolApi, Block> as TransactionPool>::Hash, Vec<String, Global>, RandomState>
)
pub fn ready_transaction(
&self,
hash: &<BasicPool<PoolApi, Block> as TransactionPool>::Hash
) -> Option<Arc<<BasicPool<PoolApi, Block> as TransactionPool>::InPoolTransaction>>
pub fn ready_at(
&self,
at: <<<BasicPool<PoolApi, Block> as TransactionPool>::Block as Block>::Header as Header>::Number
) -> Pin<Box<dyn Future<Output = Box<dyn Iterator<Item = Arc<Transaction<<<PoolApi as ChainApi>::Block as Block>::Hash, <<PoolApi as ChainApi>::Block as Block>::Extrinsic>>> + Send + 'static, Global>> + Send + 'static, Global>>
pub fn ready(
&self
) -> Box<dyn Iterator<Item = Arc<Transaction<<<PoolApi as ChainApi>::Block as Block>::Hash, <<PoolApi as ChainApi>::Block as Block>::Extrinsic>>> + Send + 'static, Global>ⓘ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;