-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Block
#10913
base: main
Are you sure you want to change the base?
Refactor Block
#10913
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is looking good, what's missing?
/// Returns whether or not the block contains any blob transactions. | ||
#[inline] | ||
pub fn has_blob_transactions(&self) -> bool { | ||
self.body.iter().any(|tx| tx.is_eip4844()) | ||
} | ||
|
||
/// Returns whether or not the block contains any EIP-7702 transactions. | ||
#[inline] | ||
pub fn has_eip7702_transactions(&self) -> bool { | ||
self.body.iter().any(|tx| tx.is_eip7702()) | ||
} | ||
|
||
/// 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] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
none of those should be removed I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved them to BlockBody
, but I'll keep them and call the BlockBody
's methods.
/// Returns an iterator over all transactions in the block. | ||
#[inline] | ||
pub fn transactions(&self) -> impl Iterator<Item = &TransactionSigned> + '_ { | ||
self.block.body.iter() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similarly, will reinstate.
Closes #10907