diff --git a/crates/primitives/src/transaction/eip1559.rs b/crates/primitives/src/transaction/eip1559.rs index 89f78e7236..5c299806b8 100644 --- a/crates/primitives/src/transaction/eip1559.rs +++ b/crates/primitives/src/transaction/eip1559.rs @@ -110,17 +110,15 @@ impl TxEip1559 { /// Encodes only the transaction's fields into the desired buffer, without a RLP header. pub(crate) fn fields_len(&self) -> usize { - let mut len = 0; - len += self.chain_id.length(); - len += self.nonce.length(); - len += self.max_priority_fee_per_gas.length(); - len += self.max_fee_per_gas.length(); - len += self.gas_limit.length(); - len += self.to.length(); - len += self.value.length(); - len += self.input.0.length(); - len += self.access_list.length(); - len + self.chain_id.length() + + self.nonce.length() + + self.max_priority_fee_per_gas.length() + + self.max_fee_per_gas.length() + + self.gas_limit.length() + + self.to.length() + + self.value.length() + + self.input.0.length() + + self.access_list.length() } /// Encodes only the transaction's fields into the desired buffer, without a RLP header. diff --git a/crates/primitives/src/transaction/eip2930.rs b/crates/primitives/src/transaction/eip2930.rs index 1e8c51f47b..036af743f2 100644 --- a/crates/primitives/src/transaction/eip2930.rs +++ b/crates/primitives/src/transaction/eip2930.rs @@ -91,16 +91,14 @@ impl TxEip2930 { /// Outputs the length of the transaction's fields, without a RLP header. pub(crate) fn fields_len(&self) -> usize { - let mut len = 0; - len += self.chain_id.length(); - len += self.nonce.length(); - len += self.gas_price.length(); - len += self.gas_limit.length(); - len += self.to.length(); - len += self.value.length(); - len += self.input.0.length(); - len += self.access_list.length(); - len + self.chain_id.length() + + self.nonce.length() + + self.gas_price.length() + + self.gas_limit.length() + + self.to.length() + + self.value.length() + + self.input.0.length() + + self.access_list.length() } /// Encodes only the transaction's fields into the desired buffer, without a RLP header. diff --git a/crates/primitives/src/transaction/eip4844.rs b/crates/primitives/src/transaction/eip4844.rs index bafe7c0196..73cb22bf3e 100644 --- a/crates/primitives/src/transaction/eip4844.rs +++ b/crates/primitives/src/transaction/eip4844.rs @@ -207,19 +207,17 @@ impl TxEip4844 { /// Outputs the length of the transaction's fields, without a RLP header. pub(crate) fn fields_len(&self) -> usize { - let mut len = 0; - len += self.chain_id.length(); - len += self.nonce.length(); - len += self.gas_limit.length(); - len += self.max_fee_per_gas.length(); - len += self.max_priority_fee_per_gas.length(); - len += self.to.length(); - len += self.value.length(); - len += self.access_list.length(); - len += self.blob_versioned_hashes.length(); - len += self.max_fee_per_blob_gas.length(); - len += self.input.0.length(); - len + self.chain_id.length() + + self.nonce.length() + + self.gas_limit.length() + + self.max_fee_per_gas.length() + + self.max_priority_fee_per_gas.length() + + self.to.length() + + self.value.length() + + self.access_list.length() + + self.blob_versioned_hashes.length() + + self.max_fee_per_blob_gas.length() + + self.input.0.length() } /// Encodes only the transaction's fields into the desired buffer, without a RLP header. diff --git a/crates/primitives/src/transaction/legacy.rs b/crates/primitives/src/transaction/legacy.rs index 2a5b0b19a9..f717764dc2 100644 --- a/crates/primitives/src/transaction/legacy.rs +++ b/crates/primitives/src/transaction/legacy.rs @@ -58,14 +58,12 @@ impl TxLegacy { /// Outputs the length of the transaction's fields, without a RLP header or length of the /// eip155 fields. pub(crate) fn fields_len(&self) -> usize { - let mut len = 0; - len += self.nonce.length(); - len += self.gas_price.length(); - len += self.gas_limit.length(); - len += self.to.length(); - len += self.value.length(); - len += self.input.0.length(); - len + self.nonce.length() + + self.gas_price.length() + + self.gas_limit.length() + + self.to.length() + + self.value.length() + + self.input.0.length() } /// Encodes only the transaction's fields into the desired buffer, without a RLP header or diff --git a/crates/primitives/src/transaction/optimism.rs b/crates/primitives/src/transaction/optimism.rs index 498e9b6873..535a7cd8f0 100644 --- a/crates/primitives/src/transaction/optimism.rs +++ b/crates/primitives/src/transaction/optimism.rs @@ -78,16 +78,14 @@ impl TxDeposit { /// Outputs the length of the transaction's fields, without a RLP header or length of the /// eip155 fields. pub(crate) fn fields_len(&self) -> usize { - let mut len = 0; - len += self.source_hash.length(); - len += self.from.length(); - len += self.to.length(); - len += self.mint.map_or(1, |mint| mint.length()); - len += self.value.length(); - len += self.gas_limit.length(); - len += self.is_system_transaction.length(); - len += self.input.0.length(); - len + self.source_hash.length() + + self.from.length() + + self.to.length() + + self.mint.map_or(1, |mint| mint.length()) + + self.value.length() + + self.gas_limit.length() + + self.is_system_transaction.length() + + self.input.0.length() } /// Encodes only the transaction's fields into the desired buffer, without a RLP header.