Struct alloy_consensus::BlockBody

source ·
pub struct BlockBody<T> {
    pub transactions: Vec<T>,
    pub ommers: Vec<Header>,
    pub withdrawals: Option<Withdrawals>,
}
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.

Fields§

§transactions: Vec<T>

Transactions in this block.

§ommers: Vec<Header>

Ommers/uncles header.

§withdrawals: Option<Withdrawals>

Block withdrawals.

Implementations§

source§

impl<T> BlockBody<T>

source

pub fn transactions(&self) -> impl Iterator<Item = &T> + '_

Returns an iterator over all transactions.

source

pub const fn into_block(self, header: Header) -> Block<T>

Create a Block from the body and its header.

source§

impl<T> BlockBody<T>

source

pub fn calculate_ommers_root(&self) -> B256

Calculate the ommers root for the block body.

source

pub fn calculate_withdrawals_root(&self) -> Option<B256>

Calculate the withdrawals root for the block body, if withdrawals exist. If there are no withdrawals, this will return None.

source§

impl<T: Transaction> BlockBody<T>

source

pub fn blob_versioned_hashes_iter(&self) -> impl Iterator<Item = &B256> + '_

Returns an iterator over all blob versioned hashes from the block body.

source§

impl<T: Typed2718> BlockBody<T>

source

pub fn has_eip4844_transactions(&self) -> bool

Returns whether or not the block body contains any blob transactions.

source

pub fn has_eip7702_transactions(&self) -> bool

Returns whether or not the block body contains any EIP-7702 transactions.

source

pub fn eip4844_transactions_iter(&self) -> impl Iterator<Item = &T> + '_

Returns an iterator over all blob transactions of the block.

Trait Implementations§

source§

impl<T: Clone> Clone for BlockBody<T>

source§

fn clone(&self) -> BlockBody<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for BlockBody<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Decodable for BlockBody<T>
where T: Decodable,

source§

fn decode(b: &mut &[u8]) -> Result<Self>

Decodes the blob into the appropriate type. buf must be advanced past the decoded object.
source§

impl<T> Default for BlockBody<T>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de, T> Deserialize<'de> for BlockBody<T>
where T: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T> Encodable for BlockBody<T>
where T: Encodable,

source§

fn length(&self) -> usize

Returns the length of the encoding of this type in bytes. Read more
source§

fn encode(&self, out: &mut dyn BufMut)

Encodes the type into the out buffer.
source§

impl<T, H> From<Block<T, H>> for BlockBody<T>

source§

fn from(block: Block<T, H>) -> Self

Converts to this type from the input type.
source§

impl<T: PartialEq> PartialEq for BlockBody<T>

source§

fn eq(&self, other: &BlockBody<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Serialize for BlockBody<T>
where T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Eq> Eq for BlockBody<T>

source§

impl<T> StructuralPartialEq for BlockBody<T>

Auto Trait Implementations§

§

impl<T> Freeze for BlockBody<T>

§

impl<T> RefUnwindSafe for BlockBody<T>
where T: RefUnwindSafe,

§

impl<T> Send for BlockBody<T>
where T: Send,

§

impl<T> Sync for BlockBody<T>
where T: Sync,

§

impl<T> Unpin for BlockBody<T>
where T: Unpin,

§

impl<T> UnwindSafe for BlockBody<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,