Not expose offer fee tx id in UI or JSON export

This commit is contained in:
Christoph Atteneder 2020-01-29 14:50:09 +01:00
parent 2887ab0bc5
commit 1d9fda74b9
No known key found for this signature in database
GPG key ID: CD5DC1C529CDFD3B
3 changed files with 23 additions and 35 deletions

View file

@ -33,9 +33,8 @@ import bisq.common.handlers.ResultHandler;
import bisq.common.storage.JsonFileManager; import bisq.common.storage.JsonFileManager;
import bisq.common.util.Utilities; import bisq.common.util.Utilities;
import javax.inject.Named;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named;
import java.io.File; import java.io.File;
@ -88,30 +87,26 @@ public class OfferBookService {
p2PService.addHashSetChangedListener(new HashMapChangedListener() { p2PService.addHashSetChangedListener(new HashMapChangedListener() {
@Override @Override
public void onAdded(Collection<ProtectedStorageEntry> protectedStorageEntries) { public void onAdded(Collection<ProtectedStorageEntry> protectedStorageEntries) {
protectedStorageEntries.forEach(protectedStorageEntry -> { protectedStorageEntries.forEach(protectedStorageEntry -> offerBookChangedListeners.forEach(listener -> {
offerBookChangedListeners.stream().forEach(listener -> { if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) {
if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) { OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload();
OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload(); Offer offer = new Offer(offerPayload);
Offer offer = new Offer(offerPayload); offer.setPriceFeedService(priceFeedService);
offer.setPriceFeedService(priceFeedService); listener.onAdded(offer);
listener.onAdded(offer); }
} }));
});
});
} }
@Override @Override
public void onRemoved(Collection<ProtectedStorageEntry> protectedStorageEntries) { public void onRemoved(Collection<ProtectedStorageEntry> protectedStorageEntries) {
protectedStorageEntries.forEach(protectedStorageEntry -> { protectedStorageEntries.forEach(protectedStorageEntry -> offerBookChangedListeners.forEach(listener -> {
offerBookChangedListeners.stream().forEach(listener -> { if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) {
if (protectedStorageEntry.getProtectedStoragePayload() instanceof OfferPayload) { OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload();
OfferPayload offerPayload = (OfferPayload) protectedStorageEntry.getProtectedStoragePayload(); Offer offer = new Offer(offerPayload);
Offer offer = new Offer(offerPayload); offer.setPriceFeedService(priceFeedService);
offer.setPriceFeedService(priceFeedService); listener.onRemoved(offer);
listener.onRemoved(offer); }
} }));
});
});
} }
}); });
@ -241,8 +236,7 @@ public class OfferBookService {
offer.getId(), offer.getId(),
offer.isUseMarketBasedPrice(), offer.isUseMarketBasedPrice(),
offer.getMarketPriceMargin(), offer.getMarketPriceMargin(),
offer.getPaymentMethod(), offer.getPaymentMethod()
offer.getOfferFeePaymentTxId()
); );
} catch (Throwable t) { } catch (Throwable t) {
// In case an offer was corrupted with null values we ignore it // In case an offer was corrupted with null values we ignore it

View file

@ -35,6 +35,8 @@ import java.util.Date;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
public class OfferForJson { public class OfferForJson {
private static final Logger log = LoggerFactory.getLogger(OfferForJson.class); private static final Logger log = LoggerFactory.getLogger(OfferForJson.class);
@ -48,7 +50,6 @@ public class OfferForJson {
public final double marketPriceMargin; public final double marketPriceMargin;
public final String paymentMethod; public final String paymentMethod;
public final String id; 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) // 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; public String currencyPair;
@ -78,25 +79,23 @@ public class OfferForJson {
String currencyCode, String currencyCode,
Coin minAmount, Coin minAmount,
Coin amount, Coin amount,
Price price, @Nullable Price price,
Date date, Date date,
String id, String id,
boolean useMarketBasedPrice, boolean useMarketBasedPrice,
double marketPriceMargin, double marketPriceMargin,
PaymentMethod paymentMethod, PaymentMethod paymentMethod) {
String offerFeeTxID) {
this.direction = direction; this.direction = direction;
this.currencyCode = currencyCode; this.currencyCode = currencyCode;
this.minAmount = minAmount.value; this.minAmount = minAmount.value;
this.amount = amount.value; this.amount = amount.value;
this.price = price.getValue(); this.price = price != null ? price.getValue() : 0;
this.date = date.getTime(); this.date = date.getTime();
this.id = id; this.id = id;
this.useMarketBasedPrice = useMarketBasedPrice; this.useMarketBasedPrice = useMarketBasedPrice;
this.marketPriceMargin = marketPriceMargin; this.marketPriceMargin = marketPriceMargin;
this.paymentMethod = paymentMethod.getId(); this.paymentMethod = paymentMethod.getId();
this.offerFeeTxID = offerFeeTxID;
setDisplayStrings(); setDisplayStrings();
} }

View file

@ -301,8 +301,6 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
rows = 3; rows = 3;
if (countryCode != null) if (countryCode != null)
rows++; rows++;
if (offer.getOfferFeePaymentTxId() != null)
rows++;
if (!isF2F) if (!isF2F)
rows++; rows++;
@ -326,9 +324,6 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.countryBank"), addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.countryBank"),
CountryUtil.getNameAndCode(countryCode)); CountryUtil.getNameAndCode(countryCode));
if (offer.getOfferFeePaymentTxId() != null)
addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("shared.makerFeeTxId"), offer.getOfferFeePaymentTxId());
if (placeOfferHandlerOptional.isPresent()) { if (placeOfferHandlerOptional.isPresent()) {
addTitledGroupBg(gridPane, ++rowIndex, 1, Res.get("offerDetailsWindow.commitment"), Layout.GROUP_DISTANCE); addTitledGroupBg(gridPane, ++rowIndex, 1, Res.get("offerDetailsWindow.commitment"), Layout.GROUP_DISTANCE);
final Tuple2<Label, Label> labelLabelTuple2 = addConfirmationLabelLabel(gridPane, rowIndex, Res.get("offerDetailsWindow.agree"), Res.get("createOffer.tac"), final Tuple2<Label, Label> labelLabelTuple2 = addConfirmationLabelLabel(gridPane, rowIndex, Res.get("offerDetailsWindow.agree"), Res.get("createOffer.tac"),