Browse Source

allow fee to be set to zero

hk-custom-address
Wei Lu 11 years ago
parent
commit
39c181dce6
  1. 2
      src/wallet.js
  2. 9
      test/wallet.js

2
src/wallet.js

@ -184,7 +184,7 @@ var Wallet = function (seed, options) {
totalInValue += output.value
if(totalInValue < value) continue;
var fee = fixedFee || estimateFeePadChangeOutput(tx)
var fee = fixedFee == undefined ? estimateFeePadChangeOutput(tx) : fixedFee
if(totalInValue < value + fee) continue;
var change = totalInValue - value - fee

9
test/wallet.js

@ -434,6 +434,15 @@ describe('Wallet', function() {
assert.deepEqual(tx.ins[1].outpoint, { hash: fakeTxHash(2), index: 1 })
})
it('allows fee to be set to zero', function(){
value = 520000
var fee = 0
var tx = wallet.createTx(to, value, fee)
assert.equal(tx.ins.length, 1)
assert.deepEqual(tx.ins[0].outpoint, { hash: fakeTxHash(3), index: 0 })
})
it('ignores spent outputs', function(){
utxo.push(
{

Loading…
Cancel
Save