Browse Source

Merge pull request #500 from sagivo/patch-2

fix bug - 0 fee is not working!
patch-2
Ryan X. Charles 11 years ago
parent
commit
d3166c12d1
  1. 8
      lib/TransactionBuilder.js

8
lib/TransactionBuilder.js

@ -109,9 +109,8 @@ function TransactionBuilder(opts) {
this.lockTime = opts.lockTime || 0;
this.spendUnconfirmed = opts.spendUnconfirmed || false;
if (opts.fee || opts.feeSat) {
this.givenFeeSat = opts.fee ? opts.fee * util.COIN : opts.feeSat;
}
this.givenFeeSat = typeof(opts.fee) !== 'undefined' ? opts.fee * util.COIN : opts.feeSat;
this.remainderOut = opts.remainderOut;
this.signhash = opts.signhash || Transaction.SIGHASH_ALL;
@ -358,8 +357,7 @@ TransactionBuilder.prototype._setFeeAndRemainder = function(txobj) {
/* based on https://en.bitcoin.it/wiki/Transaction_fees */
maxSizeK = parseInt(size / 1000) + 1;
var feeSat = this.givenFeeSat ?
this.givenFeeSat : maxSizeK * FEE_PER_1000B_SAT;
var feeSat = typeof(this.givenFeeSat) !== 'undefined' ? this.givenFeeSat : maxSizeK * FEE_PER_1000B_SAT;
var neededAmountSat = this.valueOutSat.add(feeSat);

Loading…
Cancel
Save