refactor: avoid using NoopTransactionPool in OP payload builder (#13547)

This commit is contained in:
Arsenii Kulikov
2024-12-25 11:57:53 +04:00
committed by GitHub
parent cec31ad4aa
commit 9542573854
5 changed files with 49 additions and 31 deletions

View File

@ -11,5 +11,5 @@
mod traits;
mod transaction;
pub use traits::PayloadTransactions;
pub use traits::{NoopPayloadTransactions, PayloadTransactions};
pub use transaction::{PayloadTransactionsChain, PayloadTransactionsFixed};

View File

@ -21,3 +21,17 @@ pub trait PayloadTransactions {
/// because this transaction won't be included in the block.
fn mark_invalid(&mut self, sender: Address, nonce: u64);
}
/// [`PayloadTransactions`] implementation that produces nothing.
#[derive(Debug, Default, Clone, Copy)]
pub struct NoopPayloadTransactions<T>(core::marker::PhantomData<T>);
impl<T> PayloadTransactions for NoopPayloadTransactions<T> {
type Transaction = T;
fn next(&mut self, _ctx: ()) -> Option<RecoveredTx<Self::Transaction>> {
None
}
fn mark_invalid(&mut self, _sender: Address, _nonce: u64) {}
}