Skip to content

Commit

Permalink
bug:snapsync try again when fail
Browse files Browse the repository at this point in the history
  • Loading branch information
lochjin committed Nov 18, 2024
1 parent 1f30c54 commit 0db2ff2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 8 additions & 2 deletions p2p/synch/snapsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions services/common/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down

0 comments on commit 0db2ff2

Please sign in to comment.