Revert "require height."

This reverts commit c334d1f9d8.
This commit is contained in:
Christopher Jeffrey 2016-05-12 14:17:35 -07:00
parent c334d1f9d8
commit 4ce1ed3046
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
4 changed files with 20 additions and 18 deletions

View File

@ -83,10 +83,8 @@ utils.inherits(Coin, bcoin.output);
*/
Coin.prototype.getConfirmations = function getConfirmations(height) {
assert(typeof height === 'number');
if (height === -1)
return 0;
if (height == null)
height = network.height;
if (this.height === -1)
return 0;
@ -133,7 +131,7 @@ Coin.prototype.inspect = function inspect() {
coinbase: this.coinbase,
hash: this.hash ? utils.revHex(this.hash) : null,
index: this.index,
age: this.getAge(network.height),
age: this.getAge(),
address: this.getAddress()
};
};

View File

@ -1297,7 +1297,8 @@ MTX.prototype.sortMembers = function sortMembers() {
*/
MTX.prototype.avoidFeeSniping = function avoidFeeSniping(height) {
assert(typeof height === 'number');
if (height == null)
height = network.height;
if (height === -1)
height = 0;

View File

@ -1362,10 +1362,11 @@ TX.prototype.getPriority = function getPriority(height, size) {
if (this.isCoinbase())
return new bn(0);
assert(typeof height === 'number');
if (height === -1)
height = 0;
if (height == null) {
height = this.height;
if (height === -1)
height = network.height + 1;
}
if (size == null)
size = this.maxSize();
@ -1410,7 +1411,11 @@ TX.prototype.getPriority = function getPriority(height, size) {
TX.prototype.isFree = function isFree(height, size) {
var priority;
assert(typeof height === 'number');
if (height == null) {
height = this.height;
if (height === -1)
height = network.height + 1;
}
priority = this.getPriority(height, size).priority;
@ -1478,10 +1483,8 @@ TX.prototype.getMaxFee = function getMaxFee(size, rate) {
*/
TX.prototype.getConfirmations = function getConfirmations(height) {
assert(typeof height === 'number');
if (height === -1)
return 0;
if (height == null)
height = network.height;
if (this.height === -1)
return 0;
@ -1632,8 +1635,8 @@ TX.prototype.inspect = function inspect() {
value: utils.btc(this.getOutputValue()),
fee: utils.btc(this.getFee()),
minFee: utils.btc(this.getMinFee()),
confirmations: this.getConfirmations(network.height),
priority: this.getPriority(network.height).priority.toString(10),
confirmations: this.getConfirmations(),
priority: this.getPriority().priority.toString(10),
date: utils.date(this.ts || this.ps),
block: this.block ? utils.revHex(this.block) : null,
ts: this.ts,

View File

@ -815,7 +815,7 @@ Wallet.prototype.createTX = function createTX(options, outputs, callback) {
// if (options.locktime != null)
// tx.setLocktime(options.locktime);
// else
// tx.avoidFeeSniping(network.height);
// tx.avoidFeeSniping();
// Sign the transaction
if (!self.sign(tx))