From 72e4eb71725ad62ef19df7c32aae0c013277e1c8 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 28 Jan 2020 18:13:15 +0300 Subject: [PATCH] network: fix wrong NewPing() parameters They have the opposite order, height first and nonce second. It was done wrong in 4e6ed902 and never fixed since. Fixes sending wrong peer state leading to useless getheaders messages (and disconnects when the other side is lagging behind). --- pkg/network/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/server.go b/pkg/network/server.go index 2a077ec25..104c72bff 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -388,7 +388,7 @@ func (s *Server) handleBlockCmd(p Peer, block *block.Block) error { // handlePing processes ping request. func (s *Server) handlePing(p Peer, ping *payload.Ping) error { - return p.EnqueueMessage(s.MkMsg(CMDPong, payload.NewPing(s.id, s.chain.BlockHeight()))) + return p.EnqueueMessage(s.MkMsg(CMDPong, payload.NewPing(s.chain.BlockHeight(), s.id))) } // handlePing processes pong request.