From b9b469067147fb0e12174cfc97fda47e5f80ba16 Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Mon, 14 Dec 2020 12:28:08 -0500 Subject: [PATCH 1/2] Add null checks for txId --- core/src/main/java/bisq/core/btc/wallet/WalletService.java | 3 +++ core/src/main/java/bisq/core/offer/OfferUtil.java | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/bisq/core/btc/wallet/WalletService.java b/core/src/main/java/bisq/core/btc/wallet/WalletService.java index d9e17f0f3a9..85b35ce8bf2 100644 --- a/core/src/main/java/bisq/core/btc/wallet/WalletService.java +++ b/core/src/main/java/bisq/core/btc/wallet/WalletService.java @@ -671,6 +671,9 @@ public Transaction getTransaction(Sha256Hash hash) { @Nullable public Transaction getTransaction(String txId) { + if (txId == null) { + return null; + } return getTransaction(Sha256Hash.wrap(txId)); } diff --git a/core/src/main/java/bisq/core/offer/OfferUtil.java b/core/src/main/java/bisq/core/offer/OfferUtil.java index a3ba69534d9..7852b4b09b4 100644 --- a/core/src/main/java/bisq/core/offer/OfferUtil.java +++ b/core/src/main/java/bisq/core/offer/OfferUtil.java @@ -389,7 +389,12 @@ private Optional getFeeInUserFiatCurrency(Coin makerFee, } public static Optional getInvalidMakerFeeTxErrorMessage(Offer offer, BtcWalletService btcWalletService) { - Transaction makerFeeTx = btcWalletService.getTransaction(offer.getOfferFeePaymentTxId()); + String offerFeePaymentTxId = offer.getOfferFeePaymentTxId(); + if (offerFeePaymentTxId == null) { + return Optional.empty(); + } + + Transaction makerFeeTx = btcWalletService.getTransaction(offerFeePaymentTxId); if (makerFeeTx == null) { return Optional.empty(); } From 6dc64fb128bfbbebaf9afb52ad126cf5069f1b0b Mon Sep 17 00:00:00 2001 From: chimp1984 Date: Mon, 14 Dec 2020 12:29:31 -0500 Subject: [PATCH 2/2] Don't show maker fee tx field at create offer window --- .../overlays/windows/OfferDetailsWindow.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java index 360e1e8f371..95d46979a59 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java @@ -320,12 +320,17 @@ else if (BankUtil.isBankNameRequired(countryCode)) textArea.setEditable(false); } - rows = 4; + rows = 3; if (countryCode != null) rows++; if (!isF2F) rows++; + // At create offer we do not show the makerFeeTxId + if (!placeOfferHandlerOptional.isPresent()) { + rows++; + } + TitledGroupBg titledGroupBg = addTitledGroupBg(gridPane, ++rowIndex, rows, Res.get("shared.details"), Layout.GROUP_DISTANCE); addConfirmationLabelTextFieldWithCopyIcon(gridPane, rowIndex, Res.get("shared.offerId"), offer.getId(), Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE); @@ -342,17 +347,20 @@ else if (BankUtil.isBankNameRequired(countryCode)) formatter.formatCoinWithCode(offer.getSellerSecurityDeposit()); addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), value); - TxIdTextField makerFeeTxIdTextField = addLabelTxIdTextField(gridPane, ++rowIndex, - Res.get("shared.makerFeeTxId"), offer.getOfferFeePaymentTxId()).second; - - int finalRows = rows; - OfferUtil.getInvalidMakerFeeTxErrorMessage(offer, btcWalletService) - .ifPresent(errorMsg -> { - makerFeeTxIdTextField.getTextField().setId("address-text-field-error"); - GridPane.setRowSpan(titledGroupBg, finalRows + 1); - addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.errorMessage"), - errorMsg.replace("\n\n", "\n")); - }); + // At create offer we do not show the makerFeeTxId + if (!placeOfferHandlerOptional.isPresent()) { + TxIdTextField makerFeeTxIdTextField = addLabelTxIdTextField(gridPane, ++rowIndex, + Res.get("shared.makerFeeTxId"), offer.getOfferFeePaymentTxId()).second; + + int finalRows = rows; + OfferUtil.getInvalidMakerFeeTxErrorMessage(offer, btcWalletService) + .ifPresent(errorMsg -> { + makerFeeTxIdTextField.getTextField().setId("address-text-field-error"); + GridPane.setRowSpan(titledGroupBg, finalRows + 1); + addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.errorMessage"), + errorMsg.replace("\n\n", "\n")); + }); + } if (countryCode != null && !isF2F) addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.countryBank"),