coin: drop getAge.
This commit is contained in:
parent
39ffc214dd
commit
aba22e24d7
@ -109,32 +109,11 @@ Coin.prototype.getConfirmations = function getConfirmations(height) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (height < this.height)
|
if (height < this.height)
|
||||||
return 1;
|
return 0;
|
||||||
|
|
||||||
return height - this.height + 1;
|
return height - this.height + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate coin age. This is slightly different from
|
|
||||||
* confirmations. If the confirmations are incalculable,
|
|
||||||
* age is zero. If the age is non-zero, 1 is added to the age.
|
|
||||||
* @param {Number?} height - Current chain height. Network
|
|
||||||
* height is used if not passed in.
|
|
||||||
* @returns {Number} age
|
|
||||||
*/
|
|
||||||
|
|
||||||
Coin.prototype.getAge = function getAge(height) {
|
|
||||||
var age = this.getConfirmations(height);
|
|
||||||
|
|
||||||
if (age === -1)
|
|
||||||
age = 0;
|
|
||||||
|
|
||||||
if (age !== 0)
|
|
||||||
age += 1;
|
|
||||||
|
|
||||||
return age;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert the coin to a more user-friendly object.
|
* Convert the coin to a more user-friendly object.
|
||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
|
|||||||
@ -1903,7 +1903,7 @@ TX.prototype.getConfirmations = function getConfirmations(height) {
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (height < this.height)
|
if (height < this.height)
|
||||||
return 1;
|
return 0;
|
||||||
|
|
||||||
return height - this.height + 1;
|
return height - this.height + 1;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user