[bisq-network/bisq] Add irregular txType, add check for total balance, prevent proposal withhold attack (#2587)

sqrrm notifications at github.com
Sat Mar 30 17:07:37 UTC 2019


sqrrm approved this pull request.

utACK

Looks ok but feel free to rename the function I commented on.

> @@ -811,6 +816,27 @@ public long getTotalAmountOfConfiscatedTxOutputs() {
                 .sum();
     }
 
+    public long getBurnedBsqOfAllInvalidTxs() {
+        return getTxStream()
+                .filter(e -> e.getTxType() == TxType.INVALID)
+                .mapToLong(this::getBurnedBsqOfInvalidTx)
+                .sum();
+    }
+
+    public long getBurnedBsqOfInvalidTx(Tx tx) {

This is not specific to burned txs. A better name might be `getBsqInputValue(Tx tx)`

>  
         if (sumBsq != sumUtxo) {
-            throw new RuntimeException("There is a mismatch between the UTXO set and the DAO state. Please contact the Bisq devlopers.");
+            utxoMismatches.add(new UtxoMismatch(block.getHeight(), sumUtxo, sumBsq));

If we get a mismatch it seems that will stay mismatched in the future as well and we'll get a new `UtxoMismatch` added at every block after the first one. Maybe this is good but could be a bit annoying if there is a popup for every new block.

-- 
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/2587#pullrequestreview-220828605
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190330/b7f8644c/attachment.html>


More information about the bisq-github mailing list