pub trait BlockExt: Block {
// Provided methods
fn seal_slow(self) -> SealedBlock<Self::Header, Self::Body> { ... }
fn seal(self, hash: B256) -> SealedBlock<Self::Header, Self::Body> { ... }
fn senders(&self) -> Option<Vec<Address>>
where <Self::Body as BlockBody>::Transaction: SignedTransaction { ... }
fn with_senders_unchecked(
self,
senders: Vec<Address>,
) -> BlockWithSenders<Self>
where <Self::Body as BlockBody>::Transaction: SignedTransaction { ... }
fn try_with_senders_unchecked(
self,
senders: Vec<Address>,
) -> Result<BlockWithSenders<Self>, Self>
where <Self::Body as BlockBody>::Transaction: SignedTransaction { ... }
fn with_recovered_senders(self) -> Option<BlockWithSenders<Self>>
where <Self::Body as BlockBody>::Transaction: SignedTransaction { ... }
}
Expand description
Extension trait for [reth_primitives_traits::Block
] implementations
allowing for conversions into common block parts containers such as SealedBlock
,
BlockWithSenders
, etc.
Provided Methods§
Sourcefn seal_slow(self) -> SealedBlock<Self::Header, Self::Body>
fn seal_slow(self) -> SealedBlock<Self::Header, Self::Body>
Calculate the header hash and seal the block so that it can’t be changed.
Sourcefn seal(self, hash: B256) -> SealedBlock<Self::Header, Self::Body>
fn seal(self, hash: B256) -> SealedBlock<Self::Header, Self::Body>
Seal the block with a known hash.
WARNING: This method does not perform validation whether the hash is correct.
Sourcefn senders(&self) -> Option<Vec<Address>>where
<Self::Body as BlockBody>::Transaction: SignedTransaction,
fn senders(&self) -> Option<Vec<Address>>where
<Self::Body as BlockBody>::Transaction: SignedTransaction,
Expensive operation that recovers transaction signer.
Sourcefn with_senders_unchecked(self, senders: Vec<Address>) -> BlockWithSenders<Self>where
<Self::Body as BlockBody>::Transaction: SignedTransaction,
fn with_senders_unchecked(self, senders: Vec<Address>) -> BlockWithSenders<Self>where
<Self::Body as BlockBody>::Transaction: SignedTransaction,
Transform into a BlockWithSenders
.
§Panics
If the number of senders does not match the number of transactions in the block and the signer recovery for one of the transactions fails.
Note: this is expected to be called with blocks read from disk.
Sourcefn try_with_senders_unchecked(
self,
senders: Vec<Address>,
) -> Result<BlockWithSenders<Self>, Self>where
<Self::Body as BlockBody>::Transaction: SignedTransaction,
fn try_with_senders_unchecked(
self,
senders: Vec<Address>,
) -> Result<BlockWithSenders<Self>, Self>where
<Self::Body as BlockBody>::Transaction: SignedTransaction,
Transform into a BlockWithSenders
using the given senders.
If the number of senders does not match the number of transactions in the block, this falls
back to manually recovery, but without ensuring that the signature has a low s
value.
See also recover_signers_unchecked
Returns an error if a signature is invalid.
Sourcefn with_recovered_senders(self) -> Option<BlockWithSenders<Self>>where
<Self::Body as BlockBody>::Transaction: SignedTransaction,
fn with_recovered_senders(self) -> Option<BlockWithSenders<Self>>where
<Self::Body as BlockBody>::Transaction: SignedTransaction,
Expensive. Transform into a BlockWithSenders
by recovering senders in the contained
transactions.
Returns None
if a transaction is invalid.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.