From 5f0cce492e1077af6a37cf2e39ab11593f3b3e10 Mon Sep 17 00:00:00 2001 From: woodser Date: Wed, 1 Nov 2023 09:31:22 -0400 Subject: [PATCH] fix amount adjustment above maximum limit --- .../java/haveno/desktop/main/offer/MutableOfferDataModel.java | 1 + 1 file changed, 1 insertion(+) diff --git a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java index 53876d9c..eaaa08de 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/MutableOfferDataModel.java @@ -524,6 +524,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel { // if the volume != amount * price, we need to adjust the amount if (amount.get() == null || !volumeBefore.equals(price.get().getVolumeByAmount(amount.get()))) { BigInteger value = price.get().getAmountByVolume(volumeBefore); + value = value.min(BigInteger.valueOf(getMaxTradeLimit())); // adjust if above maximum value = value.max(Restrictions.getMinTradeAmount()); // adjust if below minimum value = CoinUtil.getRoundedAmount(value, price.get(), getMaxTradeLimit(), tradeCurrencyCode.get(), paymentAccount.getPaymentMethod().getId()); amount.set(value);