diff --git a/beacon_node/network/src/sync/manager.rs b/beacon_node/network/src/sync/manager.rs index 90fa16929..c1e9cde3f 100644 --- a/beacon_node/network/src/sync/manager.rs +++ b/beacon_node/network/src/sync/manager.rs @@ -43,6 +43,7 @@ use crate::service::NetworkMessage; use crate::status::ToStatusMessage; use crate::sync::block_lookups::common::{Current, Parent}; use crate::sync::block_lookups::{BlobRequestState, BlockRequestState}; +use crate::sync::network_context::BlocksAndBlobsByRangeRequest; use crate::sync::range_sync::ByRangeRequestType; use beacon_chain::block_verification_types::AsBlock; use beacon_chain::block_verification_types::RpcBlock; @@ -1031,6 +1032,14 @@ impl SyncManager { } } Err(e) => { + // Re-insert the request so we can retry + let new_req = BlocksAndBlobsByRangeRequest { + chain_id, + batch_id: resp.batch_id, + block_blob_info: <_>::default(), + }; + self.network + .insert_range_blocks_and_blobs_request(id, new_req); // inform range that the request needs to be treated as failed // With time we will want to downgrade this log warn!( @@ -1090,6 +1099,13 @@ impl SyncManager { } } Err(e) => { + // Re-insert the request so we can retry + self.network.insert_backfill_blocks_and_blobs_requests( + id, + resp.batch_id, + <_>::default(), + ); + // inform backfill that the request needs to be treated as failed // With time we will want to downgrade this log warn!( diff --git a/beacon_node/network/src/sync/network_context.rs b/beacon_node/network/src/sync/network_context.rs index ab18c0abd..c01bc3e42 100644 --- a/beacon_node/network/src/sync/network_context.rs +++ b/beacon_node/network/src/sync/network_context.rs @@ -591,4 +591,22 @@ impl SyncNetworkContext { ByRangeRequestType::Blocks } } + + pub fn insert_range_blocks_and_blobs_request( + &mut self, + id: Id, + request: BlocksAndBlobsByRangeRequest, + ) { + self.range_blocks_and_blobs_requests.insert(id, request); + } + + pub fn insert_backfill_blocks_and_blobs_requests( + &mut self, + id: Id, + batch_id: BatchId, + request: BlocksAndBlobsRequestInfo, + ) { + self.backfill_blocks_and_blobs_requests + .insert(id, (batch_id, request)); + } }