network: adjust requestBlocs logic

If the lastQueued block index is the same as the one we'd like to
request in payload, then we need to increment the payload's count.
This commit is contained in:
Anna Shaleva 2022-12-28 12:50:30 +03:00
parent be9a231c98
commit c0a453a53b

View file

@ -1250,7 +1250,7 @@ func (s *Server) requestBlocks(bq Blockqueuer, p Peer) error {
h := bq.BlockHeight()
pl := getRequestBlocksPayload(p, h, &s.lastRequestedBlock)
lq := s.bQueue.lastQueued()
if lq > pl.IndexStart {
if lq >= pl.IndexStart {
c := int16(h + blockCacheSize - lq)
if c < payload.MaxHashesCount {
pl.Count = c