network: request blocks when there is a ping with bigger than ours height

Turns out, C# node no longer broadcasts an Inv when it's creating a block,
instead it sends a ping and if we're not paying attention to the height
specified there we're technically missing a new block. Of course we'll get it
later after ping timer expiration and regular ping/pong sequence, but that's
delaying it for no good reason.
This commit is contained in:
Roman Khimov 2020-08-14 16:22:15 +03:00
parent 92f37a5d36
commit c8cc91eeee
4 changed files with 26 additions and 0 deletions

View file

@ -286,6 +286,11 @@ func (p *localPeer) SendPing(m *Message) error {
_ = p.EnqueueMessage(m)
return nil
}
func (p *localPeer) HandlePing(ping *payload.Ping) error {
p.lastBlockIndex = ping.LastBlockIndex
return nil
}
func (p *localPeer) HandlePong(pong *payload.Ping) error {
p.lastBlockIndex = pong.LastBlockIndex
p.pingSent--