mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-10 09:37:38 +00:00
Restore is_for_block helper to reduce diff churn
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user