Skip to content

Commit

Permalink
Fix mess with uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
sammy007 committed Nov 1, 2015
1 parent 5dc7dbc commit f3b0572
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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()
Expand Down

0 comments on commit f3b0572

Please sign in to comment.