network: fix Ping messages

* NewPing() accepts block index first and nonce then.
 * Block height should be used, it'll be important for state exchanging nodes
This commit is contained in:
Roman Khimov 2021-08-06 11:26:19 +03:00
parent e41fc2fd1b
commit f9663a97a1

View file

@ -426,7 +426,7 @@ func (s *Server) runProto() {
if s.chain.BlockHeight() == prevHeight {
// Get a copy of s.peers to avoid holding a lock while sending.
for peer := range s.Peers() {
_ = peer.SendPing(NewMessage(CMDPing, payload.NewPing(s.id, s.chain.HeaderHeight())))
_ = peer.SendPing(NewMessage(CMDPing, payload.NewPing(s.chain.BlockHeight(), s.id)))
}
}
pingTimer.Reset(s.PingInterval)