Restore is_for_block helper to reduce diff churn

This commit is contained in:
dapplion
2026-05-19 12:51:32 -06:00
parent 0a6aa5ae90
commit 6e1ee05ca5
2 changed files with 8 additions and 3 deletions

View File

@@ -360,7 +360,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
if let Some((&lookup_id, lookup)) = self
.single_block_lookups
.iter_mut()
.find(|(_id, lookup)| lookup.block_root() == block_root)
.find(|(_id, lookup)| lookup.is_for_block(block_root))
{
if let Some(block_component) = block_component {
let imported = lookup.add_child_components(block_component);
@@ -382,7 +382,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
&& !self
.single_block_lookups
.iter()
.any(|(_, lookup)| lookup.block_root() == awaiting_parent.parent_root())
.any(|(_, lookup)| lookup.is_for_block(awaiting_parent.parent_root()))
{
warn!(block_root = ?awaiting_parent, "Ignoring child lookup parent lookup not found");
return false;
@@ -730,7 +730,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
let Some((id, lookup)) = self
.single_block_lookups
.iter_mut()
.find(|(_, lookup)| lookup.block_root() == block_root)
.find(|(_, lookup)| lookup.is_for_block(block_root))
else {
// Ok to ignore gossip process events
return;

View File

@@ -554,6 +554,11 @@ impl<T: BeaconChainTypes> SingleBlockLookup<T> {
self.block_root
}
/// Check the block root matches the requested block root.
pub fn is_for_block(&self, block_root: Hash256) -> bool {
self.block_root == block_root
}
pub fn awaiting_parent(&self) -> Option<AwaitingParent> {
self.awaiting_parent
}