mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(op, txpool): add conditionals to op pooled tx (#14264)
Co-authored-by: Hamdi Allam <hamdi.allam97@gmail.com>
This commit is contained in:
@ -55,6 +55,7 @@ op-alloy-consensus.workspace = true
|
||||
op-alloy-rpc-types-engine.workspace = true
|
||||
op-alloy-flz.workspace = true
|
||||
alloy-rpc-types-engine.workspace = true
|
||||
alloy-rpc-types-eth.workspace = true
|
||||
alloy-consensus.workspace = true
|
||||
|
||||
# misc
|
||||
|
||||
@ -4,6 +4,7 @@ use alloy_consensus::{
|
||||
};
|
||||
use alloy_eips::{eip2718::Encodable2718, eip7702::SignedAuthorization};
|
||||
use alloy_primitives::{Address, Bytes, TxHash, TxKind, B256, U256};
|
||||
use alloy_rpc_types_eth::erc4337::TransactionConditional;
|
||||
use parking_lot::RwLock;
|
||||
use reth_node_api::{Block, BlockBody};
|
||||
use reth_optimism_evm::RethL1BlockInfo;
|
||||
@ -50,6 +51,9 @@ pub struct OpPooledTransaction<
|
||||
estimated_tx_compressed_size: OnceLock<u64>,
|
||||
/// The pooled transaction type.
|
||||
_pd: core::marker::PhantomData<Pooled>,
|
||||
|
||||
/// Optional conditional attached to this transaction.
|
||||
conditional: Option<Box<TransactionConditional>>,
|
||||
}
|
||||
|
||||
impl<Cons: SignedTransaction, Pooled> OpPooledTransaction<Cons, Pooled> {
|
||||
@ -58,6 +62,7 @@ impl<Cons: SignedTransaction, Pooled> OpPooledTransaction<Cons, Pooled> {
|
||||
Self {
|
||||
inner: EthPooledTransaction::new(transaction, encoded_length),
|
||||
estimated_tx_compressed_size: Default::default(),
|
||||
conditional: None,
|
||||
_pd: core::marker::PhantomData,
|
||||
}
|
||||
}
|
||||
@ -70,6 +75,17 @@ impl<Cons: SignedTransaction, Pooled> OpPooledTransaction<Cons, Pooled> {
|
||||
op_alloy_flz::tx_estimated_size_fjord(&self.inner.transaction().encoded_2718())
|
||||
})
|
||||
}
|
||||
|
||||
/// Conditional setter.
|
||||
pub fn with_conditional(mut self, conditional: TransactionConditional) -> Self {
|
||||
self.conditional = Some(Box::new(conditional));
|
||||
self
|
||||
}
|
||||
|
||||
/// Conditional getter.
|
||||
pub fn conditional(&self) -> Option<&TransactionConditional> {
|
||||
self.conditional.as_deref()
|
||||
}
|
||||
}
|
||||
|
||||
impl<Cons, Pooled> PoolTransaction for OpPooledTransaction<Cons, Pooled>
|
||||
|
||||
Reference in New Issue
Block a user