Type Alias BlockBody
pub type BlockBody<T = TransactionSigned, H = Header> = BlockBody<T, H>;
Expand description
A response to GetBlockBodies
, containing bodies if any bodies were found.
Withdrawals can be optionally included at the end of the RLP encoded message.
Aliased Type§
struct BlockBody<T = TransactionSigned, H = Header> {
pub transactions: Vec<T>,
pub ommers: Vec<H>,
pub withdrawals: Option<Withdrawals>,
}
Fields§
§transactions: Vec<T>
Transactions in this block.
ommers: Vec<H>
Ommers/uncles header.
withdrawals: Option<Withdrawals>
Block withdrawals.
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 72 bytes
Implementations
§impl<T, H> BlockBody<T, H>
impl<T, H> BlockBody<T, H>
pub fn transactions(&self) -> impl Iterator<Item = &T>
pub fn transactions(&self) -> impl Iterator<Item = &T>
Returns an iterator over all transactions.
pub const fn into_block(self, header: H) -> Block<T, H>
pub const fn into_block(self, header: H) -> Block<T, H>
Create a [Block
] from the body and its header.
pub fn calculate_ommers_root(&self) -> FixedBytes<32>where
H: Encodable,
pub fn calculate_ommers_root(&self) -> FixedBytes<32>where
H: Encodable,
Calculate the ommers root for the block body.
pub fn calculate_withdrawals_root(&self) -> Option<FixedBytes<32>>
pub fn calculate_withdrawals_root(&self) -> Option<FixedBytes<32>>
Calculate the withdrawals root for the block body, if withdrawals exist. If there are no
withdrawals, this will return None
.
pub fn map_ommers<U>(self, f: impl FnMut(H) -> U) -> BlockBody<T, U>
pub fn map_ommers<U>(self, f: impl FnMut(H) -> U) -> BlockBody<T, U>
Converts the body’s ommers type by applying a function to it.
pub fn try_map_ommers<U, E>(
self,
f: impl FnMut(H) -> Result<U, E>,
) -> Result<BlockBody<T, U>, E>
pub fn try_map_ommers<U, E>( self, f: impl FnMut(H) -> Result<U, E>, ) -> Result<BlockBody<T, U>, E>
Converts the body’s ommers type by applying a fallible function to it.
§impl<T, H> BlockBody<T, H>where
T: Transaction,
impl<T, H> BlockBody<T, H>where
T: Transaction,
pub fn blob_versioned_hashes_iter(
&self,
) -> impl Iterator<Item = &FixedBytes<32>>
pub fn blob_versioned_hashes_iter( &self, ) -> impl Iterator<Item = &FixedBytes<32>>
Returns an iterator over all blob versioned hashes from the block body.
§impl<T, H> BlockBody<T, H>where
T: Typed2718,
impl<T, H> BlockBody<T, H>where
T: Typed2718,
pub fn has_eip4844_transactions(&self) -> bool
pub fn has_eip4844_transactions(&self) -> bool
Returns whether or not the block body contains any blob transactions.
pub fn has_eip7702_transactions(&self) -> bool
pub fn has_eip7702_transactions(&self) -> bool
Returns whether or not the block body contains any EIP-7702 transactions.
pub fn eip4844_transactions_iter(&self) -> impl Iterator<Item = &T>
pub fn eip4844_transactions_iter(&self) -> impl Iterator<Item = &T>
Returns an iterator over all blob transactions of the block.
Trait Implementations
§impl<'a, T, H> Arbitrary<'a> for BlockBody<T, H>
Available on crate feature arbitrary
only.
impl<'a, T, H> Arbitrary<'a> for BlockBody<T, H>
arbitrary
only.§fn arbitrary(u: &mut Unstructured<'a>) -> Result<BlockBody<T, H>, Error>
fn arbitrary(u: &mut Unstructured<'a>) -> Result<BlockBody<T, H>, Error>
Self
from the given unstructured data. Read more§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Self
from the entirety of the given
unstructured data. Read more§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured
this type
needs to construct itself. Read more§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured
this type
needs to construct itself. Read more§impl<T, H> BlockBody for BlockBody<T, H>where
T: SignedTransaction,
H: BlockHeader,
impl<T, H> BlockBody for BlockBody<T, H>where
T: SignedTransaction,
H: BlockHeader,
§type Transaction = T
type Transaction = T
§type OmmerHeader = H
type OmmerHeader = H
§fn transactions(&self) -> &[<BlockBody<T, H> as BlockBody>::Transaction]
fn transactions(&self) -> &[<BlockBody<T, H> as BlockBody>::Transaction]
§fn into_ethereum_body(self) -> BlockBody<T, H>
fn into_ethereum_body(self) -> BlockBody<T, H>
§fn into_transactions(self) -> Vec<<BlockBody<T, H> as BlockBody>::Transaction>
fn into_transactions(self) -> Vec<<BlockBody<T, H> as BlockBody>::Transaction>
Vec
of transactions.§fn withdrawals(&self) -> Option<&Withdrawals>
fn withdrawals(&self) -> Option<&Withdrawals>
§fn ommers(&self) -> Option<&[<BlockBody<T, H> as BlockBody>::OmmerHeader]>
fn ommers(&self) -> Option<&[<BlockBody<T, H> as BlockBody>::OmmerHeader]>
§fn transactions_iter(&self) -> impl Iterator<Item = &Self::Transaction>
fn transactions_iter(&self) -> impl Iterator<Item = &Self::Transaction>
§fn transaction_by_hash(
&self,
hash: &FixedBytes<32>,
) -> Option<&Self::Transaction>
fn transaction_by_hash( &self, hash: &FixedBytes<32>, ) -> Option<&Self::Transaction>
§fn clone_transactions(&self) -> Vec<Self::Transaction>
fn clone_transactions(&self) -> Vec<Self::Transaction>
§fn transaction_hashes_iter(&self) -> impl Iterator<Item = &FixedBytes<32>>
fn transaction_hashes_iter(&self) -> impl Iterator<Item = &FixedBytes<32>>
§fn transaction_count(&self) -> usize
fn transaction_count(&self) -> usize
§fn contains_transaction_type(&self, tx_type: u8) -> bool
fn contains_transaction_type(&self, tx_type: u8) -> bool
true
if the block body contains a transaction of the given type.§fn calculate_tx_root(&self) -> FixedBytes<32>
fn calculate_tx_root(&self) -> FixedBytes<32>
§fn calculate_withdrawals_root(&self) -> Option<FixedBytes<32>>
fn calculate_withdrawals_root(&self) -> Option<FixedBytes<32>>
§fn calculate_ommers_root(&self) -> Option<FixedBytes<32>>
fn calculate_ommers_root(&self) -> Option<FixedBytes<32>>
§fn blob_gas_used(&self) -> u64
fn blob_gas_used(&self) -> u64
§fn blob_versioned_hashes_iter(&self) -> impl Iterator<Item = &FixedBytes<32>>
fn blob_versioned_hashes_iter(&self) -> impl Iterator<Item = &FixedBytes<32>>
§fn encoded_2718_transactions_iter(&self) -> impl Iterator<Item = Vec<u8>>
fn encoded_2718_transactions_iter(&self) -> impl Iterator<Item = Vec<u8>>
§fn encoded_2718_transactions(&self) -> Vec<Bytes>
fn encoded_2718_transactions(&self) -> Vec<Bytes>
§fn recover_signers(&self) -> Result<Vec<Address>, RecoveryError>where
Self::Transaction: SignedTransaction,
fn recover_signers(&self) -> Result<Vec<Address>, RecoveryError>where
Self::Transaction: SignedTransaction,
§fn try_recover_signers(&self) -> Result<Vec<Address>, RecoveryError>where
Self::Transaction: SignedTransaction,
fn try_recover_signers(&self) -> Result<Vec<Address>, RecoveryError>where
Self::Transaction: SignedTransaction,
§fn recover_signers_unchecked(&self) -> Result<Vec<Address>, RecoveryError>where
Self::Transaction: SignedTransaction,
fn recover_signers_unchecked(&self) -> Result<Vec<Address>, RecoveryError>where
Self::Transaction: SignedTransaction,
s
value. Read more§fn try_recover_signers_unchecked(&self) -> Result<Vec<Address>, RecoveryError>where
Self::Transaction: SignedTransaction,
fn try_recover_signers_unchecked(&self) -> Result<Vec<Address>, RecoveryError>where
Self::Transaction: SignedTransaction,
s
value. Read more