Skip to content

Commit 460eb5c

Browse files
committed
fix(Blockchain): handle downloadPeer being unset while requesting headers
A race condition could previously happen where we try to request headers but error since there is no downloadPeer.
1 parent bf6ad4e commit 460eb5c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/blockchain.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ Blockchain.prototype._getHeaders = function (opts) {
343343
opts = opts || {}
344344
this.getLocator(opts.from || this.tip.hash, function (err, locator) {
345345
if (err) throw err
346+
if (!self.downloadPeer) return
346347
var message = self.downloadPeer.messages.GetHeaders({
347348
starts: locator
348349
})

0 commit comments

Comments
 (0)