Skip to content

Commit 060bcb2

Browse files
author
Jaap van der Plas
committed
use branch-resolved state for new SyncingHandler
1 parent e172b80 commit 060bcb2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/main/scala/io/iohk/ethereum/blockchain/sync/fast/FastSync.scala

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,25 +382,24 @@ class FastSync(
382382
// Reset the batch failures count
383383
batchFailuresCount = 0
384384

385-
// Restart syncing from the valid block available in state.
386-
syncState = syncState.copy(
387-
bestBlockHeaderNumber = firstCommonBlockNumber,
388-
nextBlockToFullyValidate = firstCommonBlockNumber + 1,
389-
pivotBlockUpdateFailures = 0
390-
)
391-
// masterPeer = Some(newMasterPeer)
392385
context.children.foreach { child =>
393386
log.debug(s"unwatching and killing $child")
394387
context.unwatch(child)
395388
child ! PoisonPill
396389
}
397390

391+
// Restart syncing from the valid block available in state.
398392
log.debug("starting with fresh SyncingHandler")
399-
val syncingHandler = new SyncingHandler(initialSyncState)
393+
val syncingHandler = new SyncingHandler(
394+
syncState.copy(
395+
bestBlockHeaderNumber = firstCommonBlockNumber,
396+
nextBlockToFullyValidate = firstCommonBlockNumber + 1,
397+
pivotBlockUpdateFailures = 0
398+
)
399+
)
400400
context.become(syncingHandler.receive)
401401
syncingHandler.processSyncing()
402402

403-
// processSyncing()
404403
case _: FastSyncBranchResolverActor.BranchResolutionFailed =>
405404
// there isn't much we can do if we don't find a branch/peer to continue syncing, so let's try again
406405
branchResolver ! FastSyncBranchResolverActor.StartBranchResolver

0 commit comments

Comments
 (0)