chore: move on_canonical_state_change to TransactionPoolExt (#3422)

This commit is contained in:
Matthias Seitz
2023-06-27 16:35:08 +02:00
committed by GitHub
parent 0a6b018536
commit d4df89616c
2 changed files with 11 additions and 11 deletions

View File

@@ -251,10 +251,6 @@ where
self.pool.block_info()
}
fn on_canonical_state_change(&self, update: CanonicalStateUpdate) {
self.pool.on_canonical_state_change(update);
}
async fn add_transaction_and_subscribe(
&self,
origin: TransactionOrigin,
@@ -373,6 +369,10 @@ where
trace!(target: "txpool", "updating pool block info");
self.pool.set_block_info(info)
}
fn on_canonical_state_change(&self, update: CanonicalStateUpdate) {
self.pool.on_canonical_state_change(update);
}
}
impl<V: TransactionValidator, T: TransactionOrdering> Clone for Pool<V, T> {

View File

@@ -36,13 +36,6 @@ pub trait TransactionPool: Send + Sync + Clone {
/// This tracks the block that the pool has last seen.
fn block_info(&self) -> BlockInfo;
/// Event listener for when the pool needs to be updated
///
/// Implementers need to update the pool accordingly.
/// For example the base fee of the pending block is determined after a block is mined which
/// affects the dynamic fee requirement of pending transactions in the pool.
fn on_canonical_state_change(&self, update: CanonicalStateUpdate);
/// Imports an _external_ transaction.
///
/// This is intended to be used by the network to insert incoming transactions received over the
@@ -212,6 +205,13 @@ pub trait TransactionPool: Send + Sync + Clone {
pub trait TransactionPoolExt: TransactionPool {
/// Sets the current block info for the pool.
fn set_block_info(&self, info: BlockInfo);
/// Event listener for when the pool needs to be updated
///
/// Implementers need to update the pool accordingly.
/// For example the base fee of the pending block is determined after a block is mined which
/// affects the dynamic fee requirement of pending transactions in the pool.
fn on_canonical_state_change(&self, update: CanonicalStateUpdate);
}
/// A Helper type that bundles all transactions in the pool.