Update dust amount

This commit is contained in:
eordano 2015-02-24 17:21:11 -03:00
parent 1893b1db0e
commit 405f4f43df
3 changed files with 13 additions and 3 deletions

View File

@ -161,7 +161,7 @@ These are the current default values in the bitcore library involved on these ch
* `Transaction.FEE_PER_KB`: `10000` (satoshis per kilobyte)
* `Transaction.FEE_SECURITY_MARGIN`: `15`
* `Transaction.DUST_AMOUNT`: `5460` (satoshis)
* `Transaction.DUST_AMOUNT`: `546` (satoshis)
## Fee calculation

View File

@ -63,7 +63,7 @@ var DEFAULT_NLOCKTIME = 0;
var DEFAULT_SEQNUMBER = 0xFFFFFFFF;
// Minimum amount for an output for it not to be considered a dust output
Transaction.DUST_AMOUNT = 5460;
Transaction.DUST_AMOUNT = 546;
// Margin of error to allow fees in the vecinity of the expected value but doesn't allow a big difference
Transaction.FEE_SECURITY_MARGIN = 15;

View File

@ -322,13 +322,23 @@ describe('Transaction', function() {
it('fails if a dust output is created', function() {
var transaction = new Transaction()
.from(simpleUtxoWith1BTC)
.to(toAddress, 1)
.to(toAddress, 545)
.change(changeAddress)
.sign(privateKey);
expect(function() {
return transaction.serialize();
}).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() {
var transaction = new Transaction()
.from(simpleUtxoWith1BTC)