diff --git a/lib/net/pool.js b/lib/net/pool.js index 42a0b586..b1189367 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -587,7 +587,8 @@ Pool.prototype.stopSync = function stopSync() { */ Pool.prototype.sendSync = co(function* sendSync(peer) { - var locator, tip, watermark; + var tip = this.chain.tip; + var locator; if (!this.syncing) return false; @@ -619,9 +620,7 @@ Pool.prototype.sendSync = co(function* sendSync(peer) { peer.blockTime = util.ms(); if (this.headersFirst) { - tip = this.chain.tip; - watermark = this.headerTip; - peer.sendGetHeaders([tip.hash], watermark.hash); + peer.sendGetHeaders([tip.hash], this.headerTip.hash); return true; } @@ -629,7 +628,7 @@ Pool.prototype.sendSync = co(function* sendSync(peer) { locator = yield this.chain.getLocator(); } catch (e) { this.emit('error', e); - return; + return false; } peer.sendGetBlocks(locator);