mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-22 03:30:38 +00:00
Dedup parent blob requests (#5432)
* de dup parent blob requests * add new line
This commit is contained in:
parent
eab3672c6d
commit
4449627c7c
@ -217,7 +217,7 @@ impl<T: BeaconChainTypes> BlockLookups<T> {
|
||||
// Make sure this block is not already downloaded, and that neither it or its parent is
|
||||
// being searched for.
|
||||
if let Some(parent_lookup) = self.parent_lookups.iter_mut().find(|parent_req| {
|
||||
parent_req.contains_block(&block_root) || parent_req.is_for_block(block_root)
|
||||
parent_req.contains_block(&parent_root) || parent_req.is_for_block(parent_root)
|
||||
}) {
|
||||
parent_lookup.add_peer(peer_id);
|
||||
// we are already searching for this block, ignore it
|
||||
|
@ -1625,6 +1625,16 @@ mod deneb_only {
|
||||
self.rig.expect_block_process(ResponseType::Block);
|
||||
self
|
||||
}
|
||||
fn search_parent_dup(mut self) -> Self {
|
||||
self.bl.search_parent(
|
||||
self.slot,
|
||||
self.block_root,
|
||||
self.block.parent_root(),
|
||||
self.peer_id,
|
||||
&mut self.cx,
|
||||
);
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn get_fork_name() -> ForkName {
|
||||
@ -2088,4 +2098,32 @@ mod deneb_only {
|
||||
.expect_no_penalty()
|
||||
.expect_block_process();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_parent_block_dup() {
|
||||
let Some(tester) =
|
||||
DenebTester::new(RequestTrigger::GossipUnknownParentBlock { num_parents: 1 })
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
tester
|
||||
.search_parent_dup()
|
||||
.expect_no_blobs_request()
|
||||
.expect_no_block_request();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn unknown_parent_blob_dup() {
|
||||
let Some(tester) =
|
||||
DenebTester::new(RequestTrigger::GossipUnknownParentBlob { num_parents: 1 })
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
||||
tester
|
||||
.search_parent_dup()
|
||||
.expect_no_blobs_request()
|
||||
.expect_no_block_request();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user