[bisq-network/bisq-core] Ack messages for all trade, offer- and dispute messages (#123)

sqrrm notifications at github.com
Tue Jun 26 16:07:50 UTC 2018


sqrrm commented on this pull request.



>              }
         } else {
-            log.error("Trader received openNewDisputeMessage. That must never happen.");
+            errorMessage = "Trader received openNewDisputeMessage. That must never happen.";
+            log.error(errorMessage);
+        }
+
+        // We use the DisputeCommunicationMessage not the openNewDisputeMessage for the ACK
+        ObservableList<DisputeCommunicationMessage> messages = openNewDisputeMessage.getDispute().getDisputeCommunicationMessages();
+        if (!messages.isEmpty()) {
+            DisputeCommunicationMessage msg = messages.get(0);

I'm not really following this, what is being acked here?

> -                        payoutTx = tradeOptional.get().getPayoutTx();
-                    } else {
-                        final Optional<Tradable> tradableOptional = closedTradableManager.getTradableById(tradeId);
-                        if (tradableOptional.isPresent() && tradableOptional.get() instanceof Trade) {
-                            payoutTx = ((Trade) tradableOptional.get()).getPayoutTx();
-                        }
+        final String tradeId = disputeResult.getTradeId();
+        Optional<Dispute> disputeOptional = findDispute(tradeId, disputeResult.getTraderId());
+        final String uid = disputeResultMessage.getUid();
+        if (!disputeOptional.isPresent()) {
+            log.debug("We got a dispute result msg but we don't have a matching dispute. " +
+                    "That might happen when we get the disputeResultMessage before the dispute was created. " +
+                    "We try again after 2 sec. to apply the disputeResultMessage. TradeId = " + tradeId);
+            if (!delayMsgMap.containsKey(uid)) {
+                // We delay2 sec. to be sure the comm. msg gets added first
+                Timer timer = UserThread.runAfter(() -> onDisputeResultMessage(disputeResultMessage), 2);

This is recursive and seems like it could result in an infinite but very slow loop if there is a real issue somehow. Even if that should never happen it would be better to not have infinite recursion. Unless I missed something on how the timer works.

-- 
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-core/pull/123#pullrequestreview-132071326
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20180626/ea3eaa10/attachment-0001.html>


More information about the bisq-github mailing list