[bisq-network/bisq] Improve TradeStatistics validation (PR #5853)

chimp1984 notifications at github.com
Tue Nov 23 00:28:15 CET 2021


@chimp1984 commented on this pull request.



> @@ -437,7 +437,12 @@ public boolean isValid() {
         }
         long maxTradeLimit = Coin.COIN.multiply(2).value;
         try {
-            maxTradeLimit = PaymentMethod.getPaymentMethodById(getPaymentMethod()).getMaxTradeLimitAsCoin(currency).value;
+            // We cover only active payment methods. Retired ones will not be found by getActivePaymentMethodById.
+            String paymentMethod = getPaymentMethod();
+            Optional<PaymentMethod> optionalPaymentMethodById = PaymentMethod.getActivePaymentMethodById(paymentMethod);
+            if (optionalPaymentMethodById.isPresent()) {
+                maxTradeLimit = optionalPaymentMethodById.get().getMaxTradeLimitAsCoin(currency).value;
+            }
         } catch (Exception ignore) {
         }

Was thinking as well but the only area where it could throw is when the payment method is not in our defined list inside tradestats, which is an expected case when a user has not updated and new payment methods got added.

-- 
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/5853#discussion_r754709320
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20211122/eca118b6/attachment.htm>


More information about the bisq-github mailing list