coin: drop getAge.

This commit is contained in:
Christopher Jeffrey 2016-11-17 08:19:52 -08:00
parent 39ffc214dd
commit aba22e24d7
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
2 changed files with 2 additions and 23 deletions

View File

@ -109,32 +109,11 @@ Coin.prototype.getConfirmations = function getConfirmations(height) {
return 0;
if (height < this.height)
return 1;
return 0;
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.
* @returns {Object}

View File

@ -1903,7 +1903,7 @@ TX.prototype.getConfirmations = function getConfirmations(height) {
return 0;
if (height < this.height)
return 1;
return 0;
return height - this.height + 1;
};