deprecate chain.getTip().
This commit is contained in:
parent
e7d0ea81f9
commit
f3980ca029
@ -492,11 +492,15 @@ Chain.prototype.getTip = function getTip() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Chain.prototype.isFull = function isFull() {
|
Chain.prototype.isFull = function isFull() {
|
||||||
|
if (!this.tip)
|
||||||
|
return false;
|
||||||
var delta = utils.now() - this.tip.ts;
|
var delta = utils.now() - this.tip.ts;
|
||||||
return delta < 40 * 60;
|
return delta < 40 * 60;
|
||||||
};
|
};
|
||||||
|
|
||||||
Chain.prototype.fillPercent = function fillPercent() {
|
Chain.prototype.fillPercent = function fillPercent() {
|
||||||
|
if (!this.tip)
|
||||||
|
return 0;
|
||||||
return Math.min(1, this.tip.ts / (utils.now() - 40 * 60));
|
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() {
|
Chain.prototype.height = function height() {
|
||||||
return this.getTip().height;
|
if (!this.tip)
|
||||||
|
return -1;
|
||||||
|
return this.tip.height;
|
||||||
};
|
};
|
||||||
|
|
||||||
Chain.prototype.currentTarget = function currentTarget() {
|
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) {
|
Chain.prototype.target = function target(last, block) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user