From 545c0004e9ce3990e1615b6d307005804546a57d Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 21 Jan 2017 13:06:20 -0800 Subject: [PATCH] pool: minor. --- lib/net/peer.js | 4 ++-- lib/net/pool.js | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/net/peer.js b/lib/net/peer.js index d0db2287..57f59def 100644 --- a/lib/net/peer.js +++ b/lib/net/peer.js @@ -124,7 +124,7 @@ function Peer(options) { this.lastPong = -1; this.lastPing = -1; this.minPing = -1; - this.lastBlock = -1; + this.blockTime = -1; this.connectTimeout = null; this.pingTimer = null; @@ -1248,7 +1248,7 @@ Peer.prototype.maybeTimeout = function maybeTimeout() { } if (this.syncing && this.loader && !this.options.isFull()) { - if (now > this.lastBlock + Peer.BLOCK_TIMEOUT) { + if (now > this.blockTime + Peer.BLOCK_TIMEOUT) { this.error('Peer is stalling (block).'); this.destroy(); return; diff --git a/lib/net/pool.js b/lib/net/pool.js index f0c1f131..cc97fa16 100644 --- a/lib/net/pool.js +++ b/lib/net/pool.js @@ -621,8 +621,7 @@ Pool.prototype.sendSync = co(function* sendSync(peer) { } peer.syncing = true; - - peer.lastBlock = util.ms(); + peer.blockTime = util.ms(); if (this.headersFirst) { tip = this.chain.tip; @@ -1944,7 +1943,7 @@ Pool.prototype._addBlock = co(function* addBlock(peer, block) { if (node.height === this.headerTip.height) { this.logger.info( 'Received checkpoint block %s (%d).', - hash, node.height); + block.rhash(), node.height); isWatermark = true; } else { this.headerChain.shift(); @@ -1952,7 +1951,7 @@ Pool.prototype._addBlock = co(function* addBlock(peer, block) { } } - peer.lastBlock = util.ms(); + peer.blockTime = util.ms(); try { yield this.chain.add(block);