From 5d45c087441607769f6a6699bf6596e5b85c87a4 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 22 Sep 2022 13:40:37 -0400 Subject: [PATCH] provide error message if price is unavailable for offer --- .../availability/tasks/SendOfferAvailabilityRequest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/bisq/core/offer/availability/tasks/SendOfferAvailabilityRequest.java b/core/src/main/java/bisq/core/offer/availability/tasks/SendOfferAvailabilityRequest.java index c980b747ca..517e661fe4 100644 --- a/core/src/main/java/bisq/core/offer/availability/tasks/SendOfferAvailabilityRequest.java +++ b/core/src/main/java/bisq/core/offer/availability/tasks/SendOfferAvailabilityRequest.java @@ -19,6 +19,7 @@ package bisq.core.offer.availability.tasks; import bisq.core.btc.model.XmrAddressEntry; import bisq.core.btc.wallet.XmrWalletService; +import bisq.core.monetary.Price; import bisq.core.offer.Offer; import bisq.core.offer.OfferUtil; import bisq.core.offer.availability.OfferAvailabilityModel; @@ -62,13 +63,17 @@ public class SendOfferAvailabilityRequest extends Task { // taker signs offer using offer id as nonce to avoid challenge protocol byte[] sig = Sig.sign(model.getP2PService().getKeyRing().getSignatureKeyPair().getPrivate(), offer.getId().getBytes(Charsets.UTF_8)); + // get price + Price price = offer.getPrice(); + if (price == null) throw new RuntimeException("Could not get price for offer"); + // send InitTradeRequest to maker to sign InitTradeRequest tradeRequest = new InitTradeRequest( offer.getId(), P2PService.getMyNodeAddress(), p2PService.getKeyRing().getPubKeyRing(), offer.getAmount().value, - offer.getPrice().getValue(), + price.getValue(), offerUtil.getTakerFee(offer.getAmount()).value, user.getAccountId(), paymentAccountId,