From e58a93d9ce09cd4cb732ebc1a69d204f4ad4c336 Mon Sep 17 00:00:00 2001 From: Thomas Coratger <60488569+tcoratger@users.noreply.github.com> Date: Mon, 22 Jan 2024 15:42:33 +0100 Subject: [PATCH] add `has_access_list` method to `TxType` (#6153) Co-authored-by: Matthias Seitz --- crates/primitives/src/transaction/tx_type.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/crates/primitives/src/transaction/tx_type.rs b/crates/primitives/src/transaction/tx_type.rs index 8154fe8b1e..579853a008 100644 --- a/crates/primitives/src/transaction/tx_type.rs +++ b/crates/primitives/src/transaction/tx_type.rs @@ -44,6 +44,18 @@ pub enum TxType { DEPOSIT = 126_isize, } +impl TxType { + /// Check if the transaction type has an access list. + pub const fn has_access_list(&self) -> bool { + match self { + TxType::Legacy => false, + TxType::EIP2930 | TxType::EIP1559 | TxType::EIP4844 => true, + #[cfg(feature = "optimism")] + TxType::DEPOSIT => false, + } + } +} + impl From for u8 { fn from(value: TxType) -> Self { match value {