network: make GetHeaders best-effort

Be a nice neighbor, try to reply with whatever headers we have, don't fail
completely because of a single missing header.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2024-12-13 16:05:43 +03:00
parent 9599fba24f
commit 90b6a42331

View file

@ -1120,7 +1120,7 @@ func (s *Server) handleGetHeadersCmd(p Peer, gh *payload.GetBlockByIndex) error
} }
header, err := s.chain.GetHeader(hash) header, err := s.chain.GetHeader(hash)
if err != nil { if err != nil {
break continue
} }
resp.Hdrs = append(resp.Hdrs, header) resp.Hdrs = append(resp.Hdrs, header)
} }