File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
crates/optimism/txpool/src Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
//! Additional support for pooled transactions with [`TransactionConditional`]
2
2
3
+ use alloy_consensus:: conditional:: BlockConditionalAttributes ;
3
4
use alloy_rpc_types_eth:: erc4337:: TransactionConditional ;
4
5
5
6
/// Helper trait that allows attaching a [`TransactionConditional`].
@@ -10,6 +11,11 @@ pub trait MaybeConditionalTransaction {
10
11
/// Get attached [`TransactionConditional`] if any.
11
12
fn conditional ( & self ) -> Option < & TransactionConditional > ;
12
13
14
+ /// Check if the conditional has exceeded the block attributes.
15
+ fn has_exceeded_block_attributes ( & self , block_attr : & BlockConditionalAttributes ) -> bool {
16
+ self . conditional ( ) . map ( |tc| tc. has_exceeded_block_attributes ( block_attr) ) . unwrap_or ( false )
17
+ }
18
+
13
19
/// Helper that sets the conditional and returns the instance again
14
20
fn with_conditional ( mut self , conditional : TransactionConditional ) -> Self
15
21
where
Original file line number Diff line number Diff line change 47
47
} ;
48
48
let mut to_remove = Vec :: new ( ) ;
49
49
for tx in & pool. pooled_transactions ( ) {
50
- if let Some ( conditional) = tx. transaction . conditional ( ) {
51
- if conditional. has_exceeded_block_attributes ( & block_attr) {
52
- to_remove. push ( * tx. hash ( ) ) ;
53
- }
50
+ if tx. transaction . has_exceeded_block_attributes ( & block_attr) {
51
+ to_remove. push ( * tx. hash ( ) ) ;
54
52
}
55
53
}
56
54
let _ = pool. remove_transactions ( to_remove) ;
You can’t perform that action at this time.
0 commit comments