allow fee to be set to zero
This commit is contained in:
parent
4d4388f6bf
commit
39c181dce6
2 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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…
Reference in a new issue