diff --git a/crates/primitives/src/transaction/tx_type.rs b/crates/primitives/src/transaction/tx_type.rs index 84a099cb7..11df417d4 100644 --- a/crates/primitives/src/transaction/tx_type.rs +++ b/crates/primitives/src/transaction/tx_type.rs @@ -85,17 +85,17 @@ impl TryFrom for TxType { fn try_from(value: u8) -> Result { #[cfg(feature = "optimism")] - if value == TxType::Deposit as u8 { + if value == TxType::Deposit { return Ok(TxType::Deposit) } - if value == TxType::Legacy as u8 { + if value == TxType::Legacy { return Ok(TxType::Legacy) - } else if value == TxType::Eip2930 as u8 { + } else if value == TxType::Eip2930 { return Ok(TxType::Eip2930) - } else if value == TxType::Eip1559 as u8 { + } else if value == TxType::Eip1559 { return Ok(TxType::Eip1559) - } else if value == TxType::Eip4844 as u8 { + } else if value == TxType::Eip4844 { return Ok(TxType::Eip4844) } @@ -175,6 +175,12 @@ impl PartialEq for TxType { } } +impl PartialEq for u8 { + fn eq(&self, other: &TxType) -> bool { + *self == *other as u8 + } +} + #[cfg(test)] mod tests { use super::*;