mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-30 01:28:21 -05:00
small refactoring for transaction field length (#6233)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user