From 9100e0dc3c1ed3e1e0c6dd0012fc6d65e56d54bc Mon Sep 17 00:00:00 2001
From: Alex Sharov <AskAlexSharov@gmail.com>
Date: Mon, 21 Mar 2022 14:07:39 +0700
Subject: [PATCH] Snapshots: fix for fresh sync (#3748)

---
 eth/stagedsync/stage_headers.go                    | 2 +-
 turbo/snapshotsync/snapshothashes/erigon-snapshots | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/eth/stagedsync/stage_headers.go b/eth/stagedsync/stage_headers.go
index 9ac44851a6..a32440a559 100644
--- a/eth/stagedsync/stage_headers.go
+++ b/eth/stagedsync/stage_headers.go
@@ -992,7 +992,7 @@ func DownloadAndIndexSnapshotsIfNeed(s *StageState, ctx context.Context, tx kv.R
 		return nil
 	}
 
-	if !cfg.snapshots.SegmentsReady() {
+	if !cfg.snapshots.SegmentsReady() || cfg.snapshots.SegmentsAvailable() < cfg.snapshotHashesCfg.ExpectBlocks {
 		if err := WaitForDownloader(ctx, tx, cfg); err != nil {
 			return err
 		}
diff --git a/turbo/snapshotsync/snapshothashes/erigon-snapshots b/turbo/snapshotsync/snapshothashes/erigon-snapshots
index cf6e317aa6..dfd2c1c3ce 160000
--- a/turbo/snapshotsync/snapshothashes/erigon-snapshots
+++ b/turbo/snapshotsync/snapshothashes/erigon-snapshots
@@ -1 +1 @@
-Subproject commit cf6e317aa616c2821bb922e383e027561aced193
+Subproject commit dfd2c1c3cef7cd4748a824c16a86a36f9eff1c3c
-- 
GitLab