drop legacy IBD check.
This commit is contained in:
parent
87d985fcdb
commit
cdddf06458
@ -34,7 +34,6 @@ var VerifyError = utils.VerifyError;
|
|||||||
* @property {Locker} locker
|
* @property {Locker} locker
|
||||||
* @property {Object} invalid
|
* @property {Object} invalid
|
||||||
* @property {Number} bestHeight
|
* @property {Number} bestHeight
|
||||||
* @property {Number} lastUpdate
|
|
||||||
* @property {ChainBlock?} tip
|
* @property {ChainBlock?} tip
|
||||||
* @property {Number} height
|
* @property {Number} height
|
||||||
* @property {Boolean} segwitActive
|
* @property {Boolean} segwitActive
|
||||||
@ -75,7 +74,6 @@ function Chain(options) {
|
|||||||
this.locker = new bcoin.locker(this, this.add, this.pendingLimit);
|
this.locker = new bcoin.locker(this, this.add, this.pendingLimit);
|
||||||
this.invalid = {};
|
this.invalid = {};
|
||||||
this.bestHeight = -1;
|
this.bestHeight = -1;
|
||||||
this.lastUpdate = utils.now();
|
|
||||||
this.tip = null;
|
this.tip = null;
|
||||||
this.height = -1;
|
this.height = -1;
|
||||||
this.synced = false;
|
this.synced = false;
|
||||||
@ -717,7 +715,7 @@ Chain.prototype._checkDuplicates = function _checkDuplicates(block, prev, callba
|
|||||||
if (network.block.bip34height === -1 || height <= network.block.bip34height)
|
if (network.block.bip34height === -1 || height <= network.block.bip34height)
|
||||||
return this._findDuplicates(block, prev, callback);
|
return this._findDuplicates(block, prev, callback);
|
||||||
|
|
||||||
self.db.get(network.block.bip34height, function(err, entry) {
|
this.db.get(network.block.bip34height, function(err, entry) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
||||||
@ -1206,10 +1204,6 @@ Chain.prototype._setBestChain = function _setBestChain(entry, prev, block, callb
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the timestamp to
|
|
||||||
// maintain a time delta of blocks.
|
|
||||||
this.lastUpdate = utils.now();
|
|
||||||
|
|
||||||
// We don't have a genesis block yet.
|
// We don't have a genesis block yet.
|
||||||
if (!this.tip) {
|
if (!this.tip) {
|
||||||
if (entry.hash !== network.genesis.hash) {
|
if (entry.hash !== network.genesis.hash) {
|
||||||
@ -1827,22 +1821,6 @@ Chain.prototype.getOrphan = function getOrphan(hash) {
|
|||||||
return this.orphan.bmap[hash] || null;
|
return this.orphan.bmap[hash] || null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the chain to see if it is synced.
|
|
||||||
* @returns {Boolean}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Chain.prototype.isFullLegacy = function isFull() {
|
|
||||||
var delta;
|
|
||||||
|
|
||||||
if (!this.tip)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
delta = utils.now() - this.tip.ts;
|
|
||||||
|
|
||||||
return delta < 4 * 60 * 60;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the chain to see if it is synced.
|
* Test the chain to see if it is synced.
|
||||||
* @returns {Boolean}
|
* @returns {Boolean}
|
||||||
@ -1852,27 +1830,6 @@ Chain.prototype.isFull = function isFull() {
|
|||||||
return !this.isInitial();
|
return !this.isInitial();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the chain to see if it is still in the initial
|
|
||||||
* syncing phase. Mimic's bitcoind's `IsInitialBlockDownload()`
|
|
||||||
* function.
|
|
||||||
* @see IsInitalBlockDownload()
|
|
||||||
* @returns {Boolean}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Chain.prototype.isInitialLegacy = function isInitial() {
|
|
||||||
var now, delta;
|
|
||||||
|
|
||||||
if (!this.tip)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
now = utils.now();
|
|
||||||
delta = now - this.lastUpdate;
|
|
||||||
|
|
||||||
// Should mimic the original IsInitialBlockDownload() function
|
|
||||||
return delta < 10 && this.tip.ts < now - 24 * 60 * 60;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the chain to see if it is still in the initial
|
* Test the chain to see if it is still in the initial
|
||||||
* syncing phase. Mimic's bitcoind's `IsInitialBlockDownload()`
|
* syncing phase. Mimic's bitcoind's `IsInitialBlockDownload()`
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user