From f3b05723c58805596cd977e482c04a303e19cc79 Mon Sep 17 00:00:00 2001 From: Sammy Libre Date: Sun, 1 Nov 2015 19:03:09 +0500 Subject: [PATCH] Fix mess with uint64 --- proxy/proxy.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/proxy/proxy.go b/proxy/proxy.go index eab2dd6..c313f2a 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -96,7 +96,7 @@ func (s *ProxyServer) rpc() *rpc.RPCClient { func (s *ProxyServer) checkUpstreams() { t := s.currentBlockTemplate() candidate := int32(0) - height := t.Height + bestHeight := int64(t.Height) backup := false prev := s.rpc() @@ -107,12 +107,13 @@ func (s *ProxyServer) checkUpstreams() { continue } + height := int64(v.Height()) // Check if upstream is ahead of previous - if v.Height()-5 >= height { - height = v.Height() + if height-5 >= bestHeight { + bestHeight = height prev.MarkSick() // Check if upstream is catching up or stuck - } else if v.Height()+5 < height { + } else if height+5 < bestHeight { v.MarkSick() } else { v.MarkAlive()