From 0835581fa97c076ec5ce979973b55f250d497d5b Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 5 Jul 2022 12:20:31 +0300 Subject: [PATCH] network: adjust the way (*Server).IsInSync() works Always return true if sync was reached once. Fix #2564. --- pkg/network/server.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index 91e591f8d..1bdedb122 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -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