network: use p.LastBlockIndex() in requestBlocks()

Always compare to the best known block index, comparing to the StartHeight is
just plain wrong now.
This commit is contained in:
Roman Khimov 2020-01-20 19:17:44 +03:00
parent 2c4ace022e
commit f56383e9c8

View file

@ -575,7 +575,7 @@ func (s *Server) requestBlocks(p Peer) error {
if len(hashes) > 0 {
payload := payload.NewInventory(payload.BlockType, hashes)
return p.EnqueueMessage(NewMessage(s.Net, CMDGetData, payload))
} else if s.chain.HeaderHeight() < p.Version().StartHeight {
} else if s.chain.HeaderHeight() < p.LastBlockIndex() {
return s.requestHeaders(p)
}
return nil