[bisq-network/bisq] Add missing check for mandatory bsq output (#2614)

Devin Bileck notifications at github.com
Tue Apr 2 07:25:55 UTC 2019


devinbileck approved this pull request.

ACK
Tested with no change output (2 BSQ available), and below minimum dust output (<7.46 BSQ available).

> @@ -550,10 +554,19 @@ private void addInputsAndChangeOutputForTx(Transaction tx, Coin fee, BsqCoinSele
         try {
             // TODO why is fee passed to getChange ???
             Coin change = bsqCoinSelector.getChange(fee, coinSelection);
+            if (requireChangeOutput) {
+                checkArgument(change.isPositive(),
+                        "This transaction requires a mandatory BSQ change output. " +
+                                "You are missing " + Restrictions.getMinNonDustOutput().value / 100d +
+                                " BSQ for a non dust change output.");

I guess all these checkArgument messages should eventually be translated.

> @@ -550,10 +554,19 @@ private void addInputsAndChangeOutputForTx(Transaction tx, Coin fee, BsqCoinSele
         try {
             // TODO why is fee passed to getChange ???
             Coin change = bsqCoinSelector.getChange(fee, coinSelection);
+            if (requireChangeOutput) {
+                checkArgument(change.isPositive(),
+                        "This transaction requires a mandatory BSQ change output. " +
+                                "You are missing " + Restrictions.getMinNonDustOutput().value / 100d +
+                                " BSQ for a non dust change output.");

And perhaps we should look into stripping the exception type when showing the popup to the user.
![image](https://user-images.githubusercontent.com/603793/55383495-2febd100-54dd-11e9-948a-c2ddfa5806bf.png)


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/2614#pullrequestreview-221472038
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190402/6d70bc71/attachment.html>


More information about the bisq-github mailing list