mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-05 03:06:16 +00:00
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:
parent
92f37a5d36
commit
c8cc91eeee
4 changed files with 26 additions and 0 deletions
|
@ -453,6 +453,16 @@ func (s *Server) handleBlockCmd(p Peer, block *block.Block) error {
|
|||
|
||||
// handlePing processes ping request.
|
||||
func (s *Server) handlePing(p Peer, ping *payload.Ping) error {
|
||||
err := p.HandlePing(ping)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if s.chain.BlockHeight() < ping.LastBlockIndex {
|
||||
err = s.requestBlocks(p)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return p.EnqueueP2PMessage(NewMessage(CMDPong, payload.NewPing(s.chain.BlockHeight(), s.id)))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue