From 8a4a875e9d4d113ebab25b22e97050508fa810d8 Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 2 Jun 2015 14:21:18 -0400 Subject: [PATCH] Ignore getheaders requests if not synced. This mimics Bitcoin Core commit a1ba0778dd3c784046dea334e5d39f37eca264f7 --- peer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/peer.go b/peer.go index a8aaf204..68b782e9 100644 --- a/peer.go +++ b/peer.go @@ -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)