File tree Expand file tree Collapse file tree 2 files changed +21
-15
lines changed
beacon_node/network/src/sync Expand file tree Collapse file tree 2 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -677,6 +677,21 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
677
677
Ok ( columns_to_request_by_peer)
678
678
}
679
679
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
+
680
695
/// Received a blocks by range or blobs by range response for a request that couples blocks '
681
696
/// and blobs.
682
697
pub fn range_block_component_response (
@@ -727,21 +742,10 @@ impl<T: BeaconChainTypes> SyncNetworkContext<T> {
727
742
}
728
743
729
744
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 ( ) ;
745
749
}
746
750
// If the request is finished, dequeue everything
747
751
Some ( blocks_result. map_err ( RpcResponseError :: BlockComponentCouplingError ) )
Original file line number Diff line number Diff line change @@ -885,6 +885,8 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
885
885
failing_batch : batch_id,
886
886
} ) ;
887
887
}
888
+ // FIXME: hack to remove range request before a retry
889
+ network. remove_range_request_by_id ( request_id) ;
888
890
self . send_batch ( network, batch_id)
889
891
} else {
890
892
debug ! (
You can’t perform that action at this time.
0 commit comments