chore: cut down on tx_type usage (#13287)

This commit is contained in:
Matthias Seitz
2024-12-11 10:37:02 +01:00
committed by GitHub
parent b34f23d880
commit 2dda8a9d13
5 changed files with 11 additions and 11 deletions

View File

@ -54,7 +54,7 @@ impl OpTransactionSigned {
/// Calculates hash of given transaction and signature and returns new instance.
pub fn new(transaction: OpTypedTransaction, signature: Signature) -> Self {
let signed_tx = Self::new_unhashed(transaction, signature);
if !matches!(signed_tx.tx_type(), OpTxType::Deposit) {
if signed_tx.ty() != OpTxType::Deposit {
signed_tx.hash.get_or_init(|| signed_tx.recalculate_hash());
}
@ -246,9 +246,10 @@ impl alloy_rlp::Decodable for OpTransactionSigned {
impl Encodable2718 for OpTransactionSigned {
fn type_flag(&self) -> Option<u8> {
match self.tx_type() {
op_alloy_consensus::OpTxType::Legacy => None,
tx_type => Some(tx_type as u8),
if Typed2718::is_legacy(self) {
None
} else {
Some(self.ty())
}
}