Update dust amount
This commit is contained in:
parent
1893b1db0e
commit
405f4f43df
|
@ -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_PER_KB`: `10000` (satoshis per kilobyte)
|
||||||
* `Transaction.FEE_SECURITY_MARGIN`: `15`
|
* `Transaction.FEE_SECURITY_MARGIN`: `15`
|
||||||
* `Transaction.DUST_AMOUNT`: `5460` (satoshis)
|
* `Transaction.DUST_AMOUNT`: `546` (satoshis)
|
||||||
|
|
||||||
## Fee calculation
|
## Fee calculation
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ var DEFAULT_NLOCKTIME = 0;
|
||||||
var DEFAULT_SEQNUMBER = 0xFFFFFFFF;
|
var DEFAULT_SEQNUMBER = 0xFFFFFFFF;
|
||||||
|
|
||||||
// Minimum amount for an output for it not to be considered a dust output
|
// 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
|
// 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;
|
Transaction.FEE_SECURITY_MARGIN = 15;
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue