From a8252ecc05eba32b6654dbd8250e6b04d407ca79 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 20 Jan 2020 17:19:35 +0300 Subject: [PATCH] network: remove wrong ping condition In reality it will never be true exactly in the case where we want this ping mechanism to work --- when the node failed to get a block from the net. It won't get the header either and thus its block height will be equal to header height. The only moment when this condition is met is when the node does initial synchronization and this synchronization works just fine without any pings. Relates to #430. --- pkg/network/tcp_peer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/network/tcp_peer.go b/pkg/network/tcp_peer.go index 8c56f9d45..2c408b22d 100644 --- a/pkg/network/tcp_peer.go +++ b/pkg/network/tcp_peer.go @@ -207,7 +207,7 @@ func (p *TCPPeer) StartProtocol() { // Try to sync in headers and block with the peer if his block height is higher then ours. if p.LastBlockIndex() > p.server.chain.BlockHeight() { err = p.server.requestBlocks(p) - } else if p.server.chain.HeaderHeight() >= p.LastBlockIndex() { + } else { block, errGetBlock := p.server.chain.GetBlock(p.server.chain.CurrentBlockHash()) if errGetBlock != nil { err = errGetBlock