Skip to content

Commit

Permalink
Fixed issue on sending BCH change that goes below dust limit
Browse files Browse the repository at this point in the history
  • Loading branch information
joemarct committed Jul 16, 2021
1 parent dd3093d commit 89a5531
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "watchtower-cash-js",
"version": "0.1.15",
"version": "0.1.16",
"description": "Library for building Javascript applications that integrate with Watchtower.cash",
"main": "src/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/bch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class BCH {
}

const feeFunderRemainder = feeInputContrib.minus(txFee)
if (feeFunderRemainder.isGreaterThan(0)) {
if (feeFunderRemainder.isGreaterThan(this.dustLimit)) {
transactionBuilder.addOutput(
bchjs.Address.toLegacyAddress(feeFunder.address),
parseInt(feeFunderRemainder)
Expand All @@ -197,7 +197,7 @@ class BCH {
} else {
// Send the BCH change back to the wallet, if any
senderRemainder = totalInput.minus(totalOutput.plus(txFee))
if (senderRemainder.isGreaterThan(0)) {
if (senderRemainder.isGreaterThan(this.dustLimit)) {
transactionBuilder.addOutput(
bchjs.Address.toLegacyAddress(changeAddress),
parseInt(senderRemainder)
Expand Down

0 comments on commit 89a5531

Please sign in to comment.