From 0db2ff2289118c5b9429a927fb8ca7f3cd7aa502 Mon Sep 17 00:00:00 2001 From: Jin Date: Mon, 18 Nov 2024 09:26:57 +0800 Subject: [PATCH] bug:snapsync try again when fail --- p2p/synch/snapsync.go | 10 ++++++++-- services/common/flags.go | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/p2p/synch/snapsync.go b/p2p/synch/snapsync.go index 73f69e32..d23d8022 100644 --- a/p2p/synch/snapsync.go +++ b/p2p/synch/snapsync.go @@ -107,12 +107,18 @@ cleanup: } else { log.Warn("Snap-sync illegal ended", "spend", time.Since(startTime).Truncate(time.Second).String(), "add", add, "processID", ps.getProcessID()) } - ps.snapStatus = nil ps.SetSyncPeer(nil) ps.processwg.Done() - return false + if ps.snapStatus.isCompleted() { + ps.snapStatus = nil + return false + } else { + ps.snapStatus = nil + go ps.TryAgainUpdateSyncPeer(false) + return true + } } func (ps *PeerSync) syncSnapStatus(pe *peers.Peer) (*pb.SnapSyncRsp, error) { diff --git a/services/common/flags.go b/services/common/flags.go index d6008828..934bc9d7 100644 --- a/services/common/flags.go +++ b/services/common/flags.go @@ -643,13 +643,11 @@ var ( &cli.BoolFlag{ Name: "dev_snapsync", Usage: "Enable snap sync for P2P that only exist in development mode", - Value: true, Destination: &cfg.DevSnapSync, }, &cli.BoolFlag{ Name: "generatenodevgap", Usage: "Generate (mine) coins using the CPU on develop mode whithout gap", - Value: true, Destination: &cfg.GenerateNoDevGap, }, }