require height.
This commit is contained in:
parent
a5d72188c0
commit
c334d1f9d8
@ -83,8 +83,10 @@ utils.inherits(Coin, bcoin.output);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Coin.prototype.getConfirmations = function getConfirmations(height) {
|
Coin.prototype.getConfirmations = function getConfirmations(height) {
|
||||||
if (height == null)
|
assert(typeof height === 'number');
|
||||||
height = network.height;
|
|
||||||
|
if (height === -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (this.height === -1)
|
if (this.height === -1)
|
||||||
return 0;
|
return 0;
|
||||||
@ -131,7 +133,7 @@ Coin.prototype.inspect = function inspect() {
|
|||||||
coinbase: this.coinbase,
|
coinbase: this.coinbase,
|
||||||
hash: this.hash ? utils.revHex(this.hash) : null,
|
hash: this.hash ? utils.revHex(this.hash) : null,
|
||||||
index: this.index,
|
index: this.index,
|
||||||
age: this.getAge(),
|
age: this.getAge(network.height),
|
||||||
address: this.getAddress()
|
address: this.getAddress()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1297,8 +1297,7 @@ MTX.prototype.sortMembers = function sortMembers() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
MTX.prototype.avoidFeeSniping = function avoidFeeSniping(height) {
|
MTX.prototype.avoidFeeSniping = function avoidFeeSniping(height) {
|
||||||
if (height == null)
|
assert(typeof height === 'number');
|
||||||
height = network.height;
|
|
||||||
|
|
||||||
if (height === -1)
|
if (height === -1)
|
||||||
height = 0;
|
height = 0;
|
||||||
|
|||||||
@ -1362,11 +1362,10 @@ TX.prototype.getPriority = function getPriority(height, size) {
|
|||||||
if (this.isCoinbase())
|
if (this.isCoinbase())
|
||||||
return new bn(0);
|
return new bn(0);
|
||||||
|
|
||||||
if (height == null) {
|
assert(typeof height === 'number');
|
||||||
height = this.height;
|
|
||||||
if (height === -1)
|
if (height === -1)
|
||||||
height = network.height + 1;
|
height = 0;
|
||||||
}
|
|
||||||
|
|
||||||
if (size == null)
|
if (size == null)
|
||||||
size = this.maxSize();
|
size = this.maxSize();
|
||||||
@ -1411,11 +1410,7 @@ TX.prototype.getPriority = function getPriority(height, size) {
|
|||||||
TX.prototype.isFree = function isFree(height, size) {
|
TX.prototype.isFree = function isFree(height, size) {
|
||||||
var priority;
|
var priority;
|
||||||
|
|
||||||
if (height == null) {
|
assert(typeof height === 'number');
|
||||||
height = this.height;
|
|
||||||
if (height === -1)
|
|
||||||
height = network.height + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
priority = this.getPriority(height, size).priority;
|
priority = this.getPriority(height, size).priority;
|
||||||
|
|
||||||
@ -1483,8 +1478,10 @@ TX.prototype.getMaxFee = function getMaxFee(size, rate) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
TX.prototype.getConfirmations = function getConfirmations(height) {
|
TX.prototype.getConfirmations = function getConfirmations(height) {
|
||||||
if (height == null)
|
assert(typeof height === 'number');
|
||||||
height = network.height;
|
|
||||||
|
if (height === -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (this.height === -1)
|
if (this.height === -1)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1635,8 +1632,8 @@ TX.prototype.inspect = function inspect() {
|
|||||||
value: utils.btc(this.getOutputValue()),
|
value: utils.btc(this.getOutputValue()),
|
||||||
fee: utils.btc(this.getFee()),
|
fee: utils.btc(this.getFee()),
|
||||||
minFee: utils.btc(this.getMinFee()),
|
minFee: utils.btc(this.getMinFee()),
|
||||||
confirmations: this.getConfirmations(),
|
confirmations: this.getConfirmations(network.height),
|
||||||
priority: this.getPriority().priority.toString(10),
|
priority: this.getPriority(network.height).priority.toString(10),
|
||||||
date: utils.date(this.ts || this.ps),
|
date: utils.date(this.ts || this.ps),
|
||||||
block: this.block ? utils.revHex(this.block) : null,
|
block: this.block ? utils.revHex(this.block) : null,
|
||||||
ts: this.ts,
|
ts: this.ts,
|
||||||
|
|||||||
@ -815,7 +815,7 @@ Wallet.prototype.createTX = function createTX(options, outputs, callback) {
|
|||||||
// if (options.locktime != null)
|
// if (options.locktime != null)
|
||||||
// tx.setLocktime(options.locktime);
|
// tx.setLocktime(options.locktime);
|
||||||
// else
|
// else
|
||||||
// tx.avoidFeeSniping();
|
// tx.avoidFeeSniping(network.height);
|
||||||
|
|
||||||
// Sign the transaction
|
// Sign the transaction
|
||||||
if (!self.sign(tx))
|
if (!self.sign(tx))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user