mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: add default for 2718 transactions (#13018)
This commit is contained in:
@ -1,13 +1,13 @@
|
||||
//! Block body abstraction.
|
||||
|
||||
use alloc::{fmt, vec::Vec};
|
||||
use alloy_consensus::Transaction;
|
||||
use alloy_eips::{eip4844::DATA_GAS_PER_BLOB, eip4895::Withdrawals};
|
||||
|
||||
use crate::{
|
||||
FullSignedTx, InMemorySize, MaybeArbitrary, MaybeSerde, MaybeSerdeBincodeCompat,
|
||||
SignedTransaction,
|
||||
};
|
||||
use alloc::{fmt, vec::Vec};
|
||||
use alloy_consensus::Transaction;
|
||||
use alloy_eips::{eip2718::Encodable2718, eip4844::DATA_GAS_PER_BLOB, eip4895::Withdrawals};
|
||||
use alloy_primitives::Bytes;
|
||||
|
||||
/// Helper trait that unifies all behaviour required by transaction to support full node operations.
|
||||
pub trait FullBlockBody: BlockBody<Transaction: FullSignedTx> {}
|
||||
@ -59,4 +59,24 @@ pub trait BlockBody:
|
||||
.map(|hashes| hashes.len() as u64 * DATA_GAS_PER_BLOB)
|
||||
.sum()
|
||||
}
|
||||
|
||||
/// Returns an iterator over the encoded 2718 transactions.
|
||||
///
|
||||
/// This is also known as `raw transactions`.
|
||||
///
|
||||
/// See also [`Encodable2718`].
|
||||
#[doc(alias = "raw_transactions_iter")]
|
||||
fn encoded_2718_transactions_iter(&self) -> impl Iterator<Item = Vec<u8>> + '_ {
|
||||
self.transactions().iter().map(|tx| tx.encoded_2718())
|
||||
}
|
||||
|
||||
/// Returns a vector of encoded 2718 transactions.
|
||||
///
|
||||
/// This is also known as `raw transactions`.
|
||||
///
|
||||
/// See also [`Encodable2718`].
|
||||
#[doc(alias = "raw_transactions")]
|
||||
fn encoded_2718_transactions(&self) -> Vec<Bytes> {
|
||||
self.encoded_2718_transactions_iter().map(Into::into).collect()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user