Skip to content

Commit c92a924

Browse files
authored
refactor: clean up and improve flashblocks build_payload (#260)
1 parent 6b1752f commit c92a924

File tree

3 files changed

+325
-277
lines changed

3 files changed

+325
-277
lines changed

crates/op-rbuilder/src/builders/flashblocks/best_txs.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
use alloy_primitives::{Address, TxHash};
22
use reth_payload_util::PayloadTransactions;
3-
use reth_transaction_pool::PoolTransaction;
4-
use std::collections::HashSet;
3+
use reth_transaction_pool::{PoolTransaction, ValidPoolTransaction};
4+
use std::{collections::HashSet, sync::Arc};
55
use tracing::debug;
66

77
use crate::tx::MaybeFlashblockFilter;
88

99
pub(super) struct BestFlashblocksTxs<T, I>
1010
where
1111
T: PoolTransaction,
12-
I: PayloadTransactions<Transaction = T>,
12+
I: Iterator<Item = Arc<ValidPoolTransaction<T>>>,
1313
{
14-
inner: I,
14+
inner: reth_payload_util::BestPayloadTransactions<T, I>,
1515
current_flashblock_number: u64,
1616
// Transactions that were already commited to the state. Using them again would cause NonceTooLow
1717
// so we skip them
@@ -21,9 +21,9 @@ where
2121
impl<T, I> BestFlashblocksTxs<T, I>
2222
where
2323
T: PoolTransaction,
24-
I: PayloadTransactions<Transaction = T>,
24+
I: Iterator<Item = Arc<ValidPoolTransaction<T>>>,
2525
{
26-
pub(super) fn new(inner: I) -> Self {
26+
pub(super) fn new(inner: reth_payload_util::BestPayloadTransactions<T, I>) -> Self {
2727
Self {
2828
inner,
2929
current_flashblock_number: 0,
@@ -33,7 +33,11 @@ where
3333

3434
/// Replaces current iterator with new one. We use it on new flashblock building, to refresh
3535
/// priority boundaries
36-
pub(super) fn refresh_iterator(&mut self, inner: I, current_flashblock_number: u64) {
36+
pub(super) fn refresh_iterator(
37+
&mut self,
38+
inner: reth_payload_util::BestPayloadTransactions<T, I>,
39+
current_flashblock_number: u64,
40+
) {
3741
self.inner = inner;
3842
self.current_flashblock_number = current_flashblock_number;
3943
}
@@ -47,7 +51,7 @@ where
4751
impl<T, I> PayloadTransactions for BestFlashblocksTxs<T, I>
4852
where
4953
T: PoolTransaction + MaybeFlashblockFilter,
50-
I: PayloadTransactions<Transaction = T>,
54+
I: Iterator<Item = Arc<ValidPoolTransaction<T>>>,
5155
{
5256
type Transaction = T;
5357

0 commit comments

Comments
 (0)