drop legacy IBD check.

This commit is contained in:
Christopher Jeffrey 2016-04-17 16:02:13 -07:00
parent 87d985fcdb
commit cdddf06458
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -34,7 +34,6 @@ var VerifyError = utils.VerifyError;
* @property {Locker} locker
* @property {Object} invalid
* @property {Number} bestHeight
* @property {Number} lastUpdate
* @property {ChainBlock?} tip
* @property {Number} height
* @property {Boolean} segwitActive
@ -75,7 +74,6 @@ function Chain(options) {
this.locker = new bcoin.locker(this, this.add, this.pendingLimit);
this.invalid = {};
this.bestHeight = -1;
this.lastUpdate = utils.now();
this.tip = null;
this.height = -1;
this.synced = false;
@ -717,7 +715,7 @@ Chain.prototype._checkDuplicates = function _checkDuplicates(block, prev, callba
if (network.block.bip34height === -1 || height <= network.block.bip34height)
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)
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.
if (!this.tip) {
if (entry.hash !== network.genesis.hash) {
@ -1827,22 +1821,6 @@ Chain.prototype.getOrphan = function getOrphan(hash) {
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.
* @returns {Boolean}
@ -1852,27 +1830,6 @@ Chain.prototype.isFull = function isFull() {
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
* syncing phase. Mimic's bitcoind's `IsInitialBlockDownload()`