network: fix GetBlocks command

Return exactly requested amount of hashes.
This commit is contained in:
Evgenii Stratonikov 2020-12-07 18:40:04 +03:00
parent 8ed1d4dfba
commit 074ba5f394

View file

@ -595,7 +595,7 @@ func (s *Server) handleGetBlocksCmd(p Peer, gb *payload.GetBlocks) error {
return err return err
} }
blockHashes := make([]util.Uint256, 0) blockHashes := make([]util.Uint256, 0)
for i := start.Index + 1; i < start.Index+uint32(count); i++ { for i := start.Index + 1; i <= start.Index+uint32(count); i++ {
hash := s.chain.GetHeaderHash(int(i)) hash := s.chain.GetHeaderHash(int(i))
if hash.Equals(util.Uint256{}) { if hash.Equals(util.Uint256{}) {
break break