deprecate chain.getTip().

This commit is contained in:
Christopher Jeffrey 2016-01-25 11:58:22 -08:00
parent e7d0ea81f9
commit f3980ca029

View File

@ -492,11 +492,15 @@ Chain.prototype.getTip = function getTip() {
};
Chain.prototype.isFull = function isFull() {
if (!this.tip)
return false;
var delta = utils.now() - this.tip.ts;
return delta < 40 * 60;
};
Chain.prototype.fillPercent = function fillPercent() {
if (!this.tip)
return 0;
return Math.min(1, this.tip.ts / (utils.now() - 40 * 60));
};
@ -602,11 +606,15 @@ Chain.prototype.size = function size() {
};
Chain.prototype.height = function height() {
return this.getTip().height;
if (!this.tip)
return -1;
return this.tip.height;
};
Chain.prototype.currentTarget = function currentTarget() {
return this.target(this.getTip());
if (!this.tip)
return utils.toCompact(network.powLimit);
return this.target(this.tip);
};
Chain.prototype.target = function target(last, block) {