network: adjust the way (*Server).IsInSync() works

Always return true if sync was reached once. Fix #2564.
This commit is contained in:
Anna Shaleva 2022-07-05 12:20:31 +03:00
parent 593f4e8734
commit 0835581fa9

View file

@ -535,8 +535,12 @@ func (s *Server) getVersionMsg() (*Message, error) {
// minimum number) and the height of these peers (our chain has to be not lower
// than 2/3 of our peers have). Ideally, we would check for the highest of the
// peers, but the problem is that they can lie to us and send whatever height
// they want to.
// they want to. Once sync reached, IsInSync will always return `true`, even if
// server is temporary out of sync after that.
func (s *Server) IsInSync() bool {
if s.syncReached.Load() {
return true
}
var peersNumber int
var notHigher int