mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: expose blob_versioned_hashes methods on block (#8530)
This commit is contained in:
@ -144,6 +144,32 @@ impl Block {
|
|||||||
self.body.iter().any(|tx| tx.is_eip4844())
|
self.body.iter().any(|tx| tx.is_eip4844())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns an iterator over all blob transactions of the block
|
||||||
|
#[inline]
|
||||||
|
pub fn blob_transactions_iter(&self) -> impl Iterator<Item = &TransactionSigned> + '_ {
|
||||||
|
self.body.iter().filter(|tx| tx.is_eip4844())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns only the blob transactions, if any, from the block body.
|
||||||
|
#[inline]
|
||||||
|
pub fn blob_transactions(&self) -> Vec<&TransactionSigned> {
|
||||||
|
self.blob_transactions_iter().collect()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns an iterator over all blob versioned hashes from the block body.
|
||||||
|
#[inline]
|
||||||
|
pub fn blob_versioned_hashes_iter(&self) -> impl Iterator<Item = &B256> + '_ {
|
||||||
|
self.blob_transactions_iter()
|
||||||
|
.filter_map(|tx| tx.as_eip4844().map(|blob_tx| &blob_tx.blob_versioned_hashes))
|
||||||
|
.flatten()
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns all blob versioned hashes from the block body.
|
||||||
|
#[inline]
|
||||||
|
pub fn blob_versioned_hashes(&self) -> Vec<&B256> {
|
||||||
|
self.blob_versioned_hashes_iter().collect()
|
||||||
|
}
|
||||||
|
|
||||||
/// Calculates a heuristic for the in-memory size of the [Block].
|
/// Calculates a heuristic for the in-memory size of the [Block].
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn size(&self) -> usize {
|
pub fn size(&self) -> usize {
|
||||||
|
|||||||
Reference in New Issue
Block a user