From 1d9fda74b9f10cfd4d19038dcc6f9817e043908e Mon Sep 17 00:00:00 2001 From: Christoph Atteneder Date: Wed, 29 Jan 2020 14:50:09 +0100 Subject: [PATCH] Not expose offer fee tx id in UI or JSON export --- .../bisq/core/offer/OfferBookService.java | 42 ++++++++----------- .../java/bisq/core/offer/OfferForJson.java | 11 +++-- .../overlays/windows/OfferDetailsWindow.java | 5 --- 3 files changed, 23 insertions(+), 35 deletions(-) diff --git a/core/src/main/java/bisq/core/offer/OfferBookService.java b/core/src/main/java/bisq/core/offer/OfferBookService.java index 823f470b85..2085429d05 100644 --- a/core/src/main/java/bisq/core/offer/OfferBookService.java +++ b/core/src/main/java/bisq/core/offer/OfferBookService.java @@ -33,9 +33,8 @@ import bisq.common.handlers.ResultHandler; import bisq.common.storage.JsonFileManager; import bisq.common.util.Utilities; -import javax.inject.Named; - import javax.inject.Inject; +import javax.inject.Named; import java.io.File; @@ -88,30 +87,26 @@ public class OfferBookService { p2PService.addHashSetChangedListener(new HashMapChangedListener() { @Override public void onAdded(Collection protectedStorageEntries) { - protectedStorageEntries.forEach(protectedStorageEntry -> { - offerBookChangedListeners.stream().forEach(listener -> { - if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) { - OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload(); - Offer offer = new Offer(offerPayload); - offer.setPriceFeedService(priceFeedService); - listener.onAdded(offer); - } - }); - }); + protectedStorageEntries.forEach(protectedStorageEntry -> offerBookChangedListeners.forEach(listener -> { + if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) { + OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload(); + Offer offer = new Offer(offerPayload); + offer.setPriceFeedService(priceFeedService); + listener.onAdded(offer); + } + })); } @Override public void onRemoved(Collection protectedStorageEntries) { - protectedStorageEntries.forEach(protectedStorageEntry -> { - offerBookChangedListeners.stream().forEach(listener -> { - if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) { - OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload(); - Offer offer = new Offer(offerPayload); - offer.setPriceFeedService(priceFeedService); - listener.onRemoved(offer); - } - }); - }); + protectedStorageEntries.forEach(protectedStorageEntry -> offerBookChangedListeners.forEach(listener -> { + if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) { + OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload(); + Offer offer = new Offer(offerPayload); + offer.setPriceFeedService(priceFeedService); + listener.onRemoved(offer); + } + })); } }); @@ -241,8 +236,7 @@ public class OfferBookService { offer.getId(), offer.isUseMarketBasedPrice(), offer.getMarketPriceMargin(), - offer.getPaymentMethod(), - offer.getOfferFeePaymentTxId() + offer.getPaymentMethod() ); } catch (Throwable t) { // In case an offer was corrupted with null values we ignore it diff --git a/core/src/main/java/bisq/core/offer/OfferForJson.java b/core/src/main/java/bisq/core/offer/OfferForJson.java index 696e8ea279..7bc67f0972 100644 --- a/core/src/main/java/bisq/core/offer/OfferForJson.java +++ b/core/src/main/java/bisq/core/offer/OfferForJson.java @@ -35,6 +35,8 @@ import java.util.Date; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.annotation.Nullable; + public class OfferForJson { private static final Logger log = LoggerFactory.getLogger(OfferForJson.class); @@ -48,7 +50,6 @@ public class OfferForJson { public final double marketPriceMargin; public final String paymentMethod; public final String id; - public final String offerFeeTxID; // primaryMarket fields are based on industry standard where primaryMarket is always in the focus (in the app BTC is always in the focus - will be changed in a larger refactoring once) public String currencyPair; @@ -78,25 +79,23 @@ public class OfferForJson { String currencyCode, Coin minAmount, Coin amount, - Price price, + @Nullable Price price, Date date, String id, boolean useMarketBasedPrice, double marketPriceMargin, - PaymentMethod paymentMethod, - String offerFeeTxID) { + PaymentMethod paymentMethod) { this.direction = direction; this.currencyCode = currencyCode; this.minAmount = minAmount.value; this.amount = amount.value; - this.price = price.getValue(); + this.price = price != null ? price.getValue() : 0; this.date = date.getTime(); this.id = id; this.useMarketBasedPrice = useMarketBasedPrice; this.marketPriceMargin = marketPriceMargin; this.paymentMethod = paymentMethod.getId(); - this.offerFeeTxID = offerFeeTxID; setDisplayStrings(); } 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 e3a87b9417..ed0cc10efa 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 @@ -301,8 +301,6 @@ public class OfferDetailsWindow extends Overlay { rows = 3; if (countryCode != null) rows++; - if (offer.getOfferFeePaymentTxId() != null) - rows++; if (!isF2F) rows++; @@ -326,9 +324,6 @@ public class OfferDetailsWindow extends Overlay { addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.countryBank"), CountryUtil.getNameAndCode(countryCode)); - if (offer.getOfferFeePaymentTxId() != null) - addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("shared.makerFeeTxId"), offer.getOfferFeePaymentTxId()); - if (placeOfferHandlerOptional.isPresent()) { addTitledGroupBg(gridPane, ++rowIndex, 1, Res.get("offerDetailsWindow.commitment"), Layout.GROUP_DISTANCE); final Tuple2 labelLabelTuple2 = addConfirmationLabelLabel(gridPane, rowIndex, Res.get("offerDetailsWindow.agree"), Res.get("createOffer.tac"),