chain: rename some methods. remove unused methods.

This commit is contained in:
Christopher Jeffrey 2017-05-14 22:11:52 -07:00
parent 18cadc7803
commit f0cc8eb128
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 5 additions and 40 deletions

View File

@ -1142,10 +1142,10 @@ Chain.prototype._invalidate = co(function* _invalidate(hash) {
* @returns {Promise}
*/
Chain.prototype.retroPrune = co(function* retroPrune() {
Chain.prototype.prune = co(function* prune() {
var unlock = yield this.locker.lock();
try {
return yield this.db.retroPrune(this.tip.hash);
return yield this.db.prune(this.tip.hash);
} finally {
unlock();
}
@ -1169,41 +1169,6 @@ Chain.prototype.scan = co(function* scan(start, filter, iter) {
}
});
/**
* Reset the chain to the desired timestamp (within 2
* hours). This is useful for replaying the blockchain
* download for SPV.
* @method
* @param {Number} ts - Timestamp.
* @returns {Promise}
*/
Chain.prototype.resetTime = co(function* resetTime(ts) {
var unlock = yield this.locker.lock();
try {
return yield this._resetTime(ts);
} finally {
unlock();
}
});
/**
* Reset the chain to the desired timestamp without a lock.
* @private
* @method
* @param {Number} ts - Timestamp.
* @returns {Promise}
*/
Chain.prototype._resetTime = co(function* resetTime(ts) {
var entry = yield this.byTime(ts);
if (!entry)
return;
yield this._reset(entry.height, false);
});
/**
* Add a block to the chain, perform all necessary verification.
* @method

View File

@ -548,7 +548,7 @@ ChainDB.prototype.verifyFlags = co(function* verifyFlags(state) {
if (needsPrune) {
yield this.logger.info('Retroactively pruning chain.');
yield this.retroPrune(state.hash());
yield this.prune(state.hash());
}
});
@ -706,7 +706,7 @@ ChainDB.prototype.invalidateCache = co(function* invalidateCache(bit, batch) {
* @returns {Promise}
*/
ChainDB.prototype.retroPrune = co(function* retroPrune(tip) {
ChainDB.prototype.prune = co(function* prune(tip) {
var options = this.options;
var keepBlocks = this.network.block.keepBlocks;
var pruneAfter = this.network.block.pruneAfterHeight;
@ -715,7 +715,7 @@ ChainDB.prototype.retroPrune = co(function* retroPrune(tip) {
var i, start, end, batch, hash;
if (flags.prune)
throw new Error('Already pruned.');
throw new Error('Chain is already pruned.');
if (height <= pruneAfter + keepBlocks)
return false;