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.
This commit is contained in:
Roman Khimov 2020-01-20 17:19:35 +03:00
parent 247cfa4165
commit a8252ecc05

View file

@ -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. // 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() { if p.LastBlockIndex() > p.server.chain.BlockHeight() {
err = p.server.requestBlocks(p) err = p.server.requestBlocks(p)
} else if p.server.chain.HeaderHeight() >= p.LastBlockIndex() { } else {
block, errGetBlock := p.server.chain.GetBlock(p.server.chain.CurrentBlockHash()) block, errGetBlock := p.server.chain.GetBlock(p.server.chain.CurrentBlockHash())
if errGetBlock != nil { if errGetBlock != nil {
err = errGetBlock err = errGetBlock