Skip to content

Commit 790c94c

Browse files
committed
Try a different hack
1 parent 9181ff4 commit 790c94c

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

beacon_node/network/src/sync/network_context.rs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,21 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
677677
Ok(columns_to_request_by_peer)
678678
}
679679

680+
/// Remove the range request before attempting a retry.
681+
pub(crate) fn remove_range_request_by_id(&mut self, id: Id) {
682+
if let Some(request_id) = self
683+
.components_by_range_requests
684+
.keys()
685+
.find(|r| r.id == id)
686+
{
687+
let request_id = ComponentsByRangeRequestId {
688+
id,
689+
requester: request_id.requester,
690+
};
691+
self.components_by_range_requests.remove(&request_id);
692+
};
693+
}
694+
680695
/// Received a blocks by range or blobs by range response for a request that couples blocks '
681696
/// and blobs.
682697
pub fn range_block_component_response(
@@ -727,21 +742,10 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
727742
}
728743

729744
if let Some(blocks_result) = entry.get_mut().responses(&self.chain.spec) {
730-
match blocks_result.as_ref() {
731-
Ok(_) => {
732-
// remove the entry only if it coupled successfully with
733-
// no errors
734-
entry.remove();
735-
}
736-
Err(&CouplingError {
737-
msg: _,
738-
column_and_peer: None,
739-
}) => {
740-
// remove the entry only if the coupling error has no columns specified, as the
741-
// entire batch will be retried
742-
entry.remove();
743-
}
744-
_ => {}
745+
if blocks_result.is_ok() {
746+
// remove the entry only if it coupled successfully with
747+
// no errors
748+
entry.remove();
745749
}
746750
// If the request is finished, dequeue everything
747751
Some(blocks_result.map_err(RpcResponseError::BlockComponentCouplingError))

beacon_node/network/src/sync/range_sync/chain.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,8 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
885885
failing_batch: batch_id,
886886
});
887887
}
888+
// FIXME: hack to remove range request before a retry
889+
network.remove_range_request_by_id(request_id);
888890
self.send_batch(network, batch_id)
889891
} else {
890892
debug!(

0 commit comments

Comments
 (0)