pool: minor.
This commit is contained in:
parent
be4145e163
commit
545c0004e9
@ -124,7 +124,7 @@ function Peer(options) {
|
|||||||
this.lastPong = -1;
|
this.lastPong = -1;
|
||||||
this.lastPing = -1;
|
this.lastPing = -1;
|
||||||
this.minPing = -1;
|
this.minPing = -1;
|
||||||
this.lastBlock = -1;
|
this.blockTime = -1;
|
||||||
|
|
||||||
this.connectTimeout = null;
|
this.connectTimeout = null;
|
||||||
this.pingTimer = null;
|
this.pingTimer = null;
|
||||||
@ -1248,7 +1248,7 @@ Peer.prototype.maybeTimeout = function maybeTimeout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.syncing && this.loader && !this.options.isFull()) {
|
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.error('Peer is stalling (block).');
|
||||||
this.destroy();
|
this.destroy();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -621,8 +621,7 @@ Pool.prototype.sendSync = co(function* sendSync(peer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
peer.syncing = true;
|
peer.syncing = true;
|
||||||
|
peer.blockTime = util.ms();
|
||||||
peer.lastBlock = util.ms();
|
|
||||||
|
|
||||||
if (this.headersFirst) {
|
if (this.headersFirst) {
|
||||||
tip = this.chain.tip;
|
tip = this.chain.tip;
|
||||||
@ -1944,7 +1943,7 @@ Pool.prototype._addBlock = co(function* addBlock(peer, block) {
|
|||||||
if (node.height === this.headerTip.height) {
|
if (node.height === this.headerTip.height) {
|
||||||
this.logger.info(
|
this.logger.info(
|
||||||
'Received checkpoint block %s (%d).',
|
'Received checkpoint block %s (%d).',
|
||||||
hash, node.height);
|
block.rhash(), node.height);
|
||||||
isWatermark = true;
|
isWatermark = true;
|
||||||
} else {
|
} else {
|
||||||
this.headerChain.shift();
|
this.headerChain.shift();
|
||||||
@ -1952,7 +1951,7 @@ Pool.prototype._addBlock = co(function* addBlock(peer, block) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
peer.lastBlock = util.ms();
|
peer.blockTime = util.ms();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
yield this.chain.add(block);
|
yield this.chain.add(block);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user