forked from TrueCloudLab/neoneo-go
network: don't request block we already have
GetBlockByIndex handler starts sending blocks right from the start index and if that index is s.chain.BlockHeight() then we're requesting and receiving a block we already have.
This commit is contained in:
parent
c8cc91eeee
commit
8d19f0e6f5
1 changed files with 1 additions and 1 deletions
|
@ -704,7 +704,7 @@ func (s *Server) handleGetAddrCmd(p Peer) error {
|
||||||
// to sync up in blocks. A maximum of maxBlockBatch will
|
// to sync up in blocks. A maximum of maxBlockBatch will
|
||||||
// send at once.
|
// send at once.
|
||||||
func (s *Server) requestBlocks(p Peer) error {
|
func (s *Server) requestBlocks(p Peer) error {
|
||||||
payload := payload.NewGetBlockByIndex(s.chain.BlockHeight(), -1)
|
payload := payload.NewGetBlockByIndex(s.chain.BlockHeight()+1, -1)
|
||||||
return p.EnqueueP2PMessage(NewMessage(CMDGetBlockByIndex, payload))
|
return p.EnqueueP2PMessage(NewMessage(CMDGetBlockByIndex, payload))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue