pool: minor.

This commit is contained in:
Christopher Jeffrey 2017-01-21 13:06:20 -08:00
parent be4145e163
commit 545c0004e9
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 5 additions and 6 deletions

View File

@ -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;

View File

@ -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);