forked from TrueCloudLab/neoneo-go
Merge pull request #2582 from nspcc-dev/fix-server-sync
network: adjust the way (*Server).IsInSync() works
This commit is contained in:
commit
3fbc1331aa
1 changed files with 5 additions and 1 deletions
|
@ -537,8 +537,12 @@ func (s *Server) getVersionMsg() (*Message, error) {
|
||||||
// minimum number) and the height of these peers (our chain has to be not lower
|
// 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
|
// 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
|
// 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 {
|
func (s *Server) IsInSync() bool {
|
||||||
|
if s.syncReached.Load() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
var peersNumber int
|
var peersNumber int
|
||||||
var notHigher int
|
var notHigher int
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue