pool: do not reset chain when checkpoints=false.
This commit is contained in:
parent
69b442a318
commit
f20aae676a
@ -1739,9 +1739,9 @@ Chain.prototype._getLocator = co(function* getLocator(start) {
|
|||||||
entry = this.tip;
|
entry = this.tip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hash = entry.hash;
|
||||||
height = entry.height;
|
height = entry.height;
|
||||||
main = yield entry.isMainChain();
|
main = yield entry.isMainChain();
|
||||||
hash = entry.hash;
|
|
||||||
|
|
||||||
while (hash) {
|
while (hash) {
|
||||||
hashes.push(hash);
|
hashes.push(hash);
|
||||||
@ -1749,7 +1749,7 @@ Chain.prototype._getLocator = co(function* getLocator(start) {
|
|||||||
if (height === 0)
|
if (height === 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
height = Math.max(height - step, 0);
|
height = Math.max(0, height - step);
|
||||||
|
|
||||||
if (hashes.length > 10)
|
if (hashes.length > 10)
|
||||||
step *= 2;
|
step *= 2;
|
||||||
|
|||||||
@ -162,7 +162,8 @@ Pool.prototype._init = function _init() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.chain.on('reset', function() {
|
this.chain.on('reset', function() {
|
||||||
self.resetChain();
|
if (self.checkpoints)
|
||||||
|
self.resetChain();
|
||||||
self.forceSync();
|
self.forceSync();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -247,8 +248,7 @@ Pool.prototype.resetChain = function resetChain() {
|
|||||||
this.headerChain.push(new HeaderEntry(tip.hash, tip.height));
|
this.headerChain.push(new HeaderEntry(tip.hash, tip.height));
|
||||||
this.logger.info(
|
this.logger.info(
|
||||||
'Initialized header chain to height %d (checkpoint=%s).',
|
'Initialized header chain to height %d (checkpoint=%s).',
|
||||||
tip.height,
|
tip.height, util.revHex(this.headerTip.hash));
|
||||||
this.headerTip.hash);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1143,7 +1143,8 @@ Pool.prototype.handleClose = co(function* handleClose(peer, connected) {
|
|||||||
|
|
||||||
if (loader) {
|
if (loader) {
|
||||||
this.logger.info('Removed loader peer (%s).', peer.hostname());
|
this.logger.info('Removed loader peer (%s).', peer.hostname());
|
||||||
this.resetChain();
|
if (this.checkpoints)
|
||||||
|
this.resetChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nonces.remove(peer.hostname());
|
this.nonces.remove(peer.hostname());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user