From 14e97b2c43dccb40e9e1031304f2e29ec4143588 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 14 Nov 2022 20:34:15 +0100 Subject: [PATCH] chore(txpool): add external transaction helper function (#201) --- crates/transaction-pool/src/traits.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index fb7064dd3..81caa7206 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -23,6 +23,14 @@ pub trait TransactionPool: Send + Sync + 'static { /// affects the dynamic fee requirement of pending transactions in the pool. fn on_new_block(&self, event: OnNewBlockEvent); + /// Imports an _external_ transaction. + /// + /// This is intended to be used by the network to insert incoming transactions received over the + /// p2p network. + async fn add_external_transaction(&self, transaction: Self::Transaction) -> PoolResult { + self.add_transaction(TransactionOrigin::External, transaction).await + } + /// Adds an _unvalidated_ transaction into the pool. /// /// Consumer: RPC