Skip to content

Commit

Permalink
feat: port reth pooled tx type (#1767)
Browse files Browse the repository at this point in the history
* feat: port reth pooled tx type

* complete impl

* Update crates/consensus/src/transaction/pooled.rs

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>

* rustmft

---------

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
  • Loading branch information
mattsse and klkvr authored Dec 7, 2024
1 parent 72fc50e commit ae92049
Show file tree
Hide file tree
Showing 3 changed files with 566 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/consensus/src/transaction/eip4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ impl TxEip4844Variant {
Self::TxEip4844WithSidecar(tx) => tx.size(),
}
}

/// Tries to unwrap the [`TxEip4844WithSidecar`] returns the transaction as error if it is not a
/// [`TxEip4844WithSidecar`]
pub fn try_into_4844_with_sidecar(self) -> Result<TxEip4844WithSidecar, Self> {
match self {
Self::TxEip4844WithSidecar(tx) => Ok(tx),
_ => Err(self),
}
}
}

impl Transaction for TxEip4844Variant {
Expand Down
2 changes: 2 additions & 0 deletions crates/consensus/src/transaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub use eip7702::TxEip7702;

/// [EIP-4844] constants, helpers, and types.
pub mod eip4844;
pub mod pooled;
pub use pooled::PooledTransaction;

use alloy_eips::eip4844::DATA_GAS_PER_BLOB;
pub use alloy_eips::eip4844::{
Expand Down
Loading

0 comments on commit ae92049

Please sign in to comment.