Ignore getheaders requests if not synced.
This mimics Bitcoin Core commit a1ba0778dd3c784046dea334e5d39f37eca264f7
This commit is contained in:
parent
1ddf8e8edf
commit
8a4a875e9d
1 changed files with 5 additions and 0 deletions
5
peer.go
5
peer.go
|
@ -1012,6 +1012,11 @@ func (p *peer) handleGetBlocksMsg(msg *wire.MsgGetBlocks) {
|
||||||
// handleGetHeadersMsg is invoked when a peer receives a getheaders bitcoin
|
// handleGetHeadersMsg is invoked when a peer receives a getheaders bitcoin
|
||||||
// message.
|
// message.
|
||||||
func (p *peer) handleGetHeadersMsg(msg *wire.MsgGetHeaders) {
|
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.
|
// Attempt to look up the height of the provided stop hash.
|
||||||
endIdx := database.AllShas
|
endIdx := database.AllShas
|
||||||
height, err := p.server.db.FetchBlockHeightBySha(&msg.HashStop)
|
height, err := p.server.db.FetchBlockHeightBySha(&msg.HashStop)
|
||||||
|
|
Loading…
Reference in a new issue