check for dust before creating transaction
This commit is contained in:
parent
913b48e87f
commit
7c81bfef72
2 changed files with 22 additions and 4 deletions
src
|
@ -179,6 +179,8 @@ var Wallet = function (seed, options) {
|
|||
}
|
||||
|
||||
this.createTx = function(to, value, fixedFee) {
|
||||
checkDust(value)
|
||||
|
||||
var tx = new Transaction()
|
||||
tx.addOutput(to, value)
|
||||
|
||||
|
@ -206,6 +208,12 @@ var Wallet = function (seed, options) {
|
|||
return tx
|
||||
}
|
||||
|
||||
function checkDust(value){
|
||||
if (isNullOrUndefined(value) || value < 5430) {
|
||||
throw new Error("Value below dust threshold")
|
||||
}
|
||||
}
|
||||
|
||||
function estimateFeePadChangeOutput(tx){
|
||||
var tmpTx = tx.clone()
|
||||
tmpTx.addOutput(getChangeAddress(), 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue