|
@ -322,13 +322,23 @@ describe('Transaction', function() { |
|
|
it('fails if a dust output is created', function() { |
|
|
it('fails if a dust output is created', function() { |
|
|
var transaction = new Transaction() |
|
|
var transaction = new Transaction() |
|
|
.from(simpleUtxoWith1BTC) |
|
|
.from(simpleUtxoWith1BTC) |
|
|
.to(toAddress, 1) |
|
|
.to(toAddress, 545) |
|
|
.change(changeAddress) |
|
|
.change(changeAddress) |
|
|
.sign(privateKey); |
|
|
.sign(privateKey); |
|
|
expect(function() { |
|
|
expect(function() { |
|
|
return transaction.serialize(); |
|
|
return transaction.serialize(); |
|
|
}).to.throw(errors.Transaction.DustOutputs); |
|
|
}).to.throw(errors.Transaction.DustOutputs); |
|
|
}); |
|
|
}); |
|
|
|
|
|
it('doesn\'t fail if a dust output is not dust', function() { |
|
|
|
|
|
var transaction = new Transaction() |
|
|
|
|
|
.from(simpleUtxoWith1BTC) |
|
|
|
|
|
.to(toAddress, 546) |
|
|
|
|
|
.change(changeAddress) |
|
|
|
|
|
.sign(privateKey); |
|
|
|
|
|
expect(function() { |
|
|
|
|
|
return transaction.serialize(); |
|
|
|
|
|
}).to.not.throw(errors.Transaction.DustOutputs); |
|
|
|
|
|
}); |
|
|
it('doesn\'t fail if a dust output is an op_return', function() { |
|
|
it('doesn\'t fail if a dust output is an op_return', function() { |
|
|
var transaction = new Transaction() |
|
|
var transaction = new Transaction() |
|
|
.from(simpleUtxoWith1BTC) |
|
|
.from(simpleUtxoWith1BTC) |
|
|