File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
src/main/scala/io/iohk/ethereum/blockchain/sync/fast Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -284,12 +284,26 @@ class FastSync(
284
284
if (batchFailuresCount > fastSyncMaxBatchRetries) {
285
285
log.info(" Max skeleton batch failures reached. Master peer must be wrong." )
286
286
handleRewind(header, masterPeer.get, fastSyncBlockValidationN, blacklistDuration)
287
+
288
+ // Start branch resolution and wait for response from the FastSyncBranchResolver actor.
289
+ context become waitingForBranchResolution
287
290
branchResolver ! FastSyncBranchResolver .StartBranchResolver
288
- // TODO: Become waiting for a branch resolution
289
291
currentSkeleton = None
290
292
}
291
293
}
292
294
295
+ private def waitingForBranchResolution : Receive = handleCommonMessages orElse handleStatus orElse {
296
+ case FastSyncBranchResolver .BranchResolvedSuccessful (firstCommonBlockNumber, resolvedPeer) =>
297
+ // Reset the batch failures count
298
+ batchFailuresCount = 0
299
+
300
+ // Restart syncing from the valid block available in state.
301
+ syncState = syncState.copy(bestBlockHeaderNumber = firstCommonBlockNumber)
302
+ masterPeer = Some (resolvedPeer)
303
+ context become receive
304
+ processSyncing()
305
+ }
306
+
293
307
private def blockHeadersError (peer : Peer ) = {
294
308
blacklist(peer.id, blacklistDuration, " error in block headers response" )
295
309
processSyncing()
You can’t perform that action at this time.
0 commit comments