Ignore getheaders requests if not synced.

This mimics Bitcoin Core commit a1ba0778dd3c784046dea334e5d39f37eca264f7
This commit is contained in:
David Hill 2015-06-02 14:21:18 -04:00
parent 1ddf8e8edf
commit 8a4a875e9d

View file

@ -1012,6 +1012,11 @@ func (p *peer) handleGetBlocksMsg(msg *wire.MsgGetBlocks) {
// handleGetHeadersMsg is invoked when a peer receives a getheaders bitcoin
// message.
func (p *peer) handleGetHeadersMsg(msg *wire.MsgGetHeaders) {
// Ignore getheaders requests if not in sync.
if !p.server.blockManager.IsCurrent() {
return
}
// Attempt to look up the height of the provided stop hash.
endIdx := database.AllShas
height, err := p.server.db.FetchBlockHeightBySha(&msg.HashStop)