diff --git a/cli/src/main/java/bisq/cli/table/builder/AbstractTradeListBuilder.java b/cli/src/main/java/bisq/cli/table/builder/AbstractTradeListBuilder.java index 1c0fcf52..7a4b8c74 100644 --- a/cli/src/main/java/bisq/cli/table/builder/AbstractTradeListBuilder.java +++ b/cli/src/main/java/bisq/cli/table/builder/AbstractTradeListBuilder.java @@ -63,8 +63,6 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder { @Nullable protected final Column colMixedAmount; @Nullable - protected final Column colMinerTxFee; - @Nullable protected final MixedTradeFeeColumn colMixedTradeFee; @Nullable protected final Column colBuyerDeposit; @@ -115,7 +113,6 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder { this.colCurrency = colSupplier.currencyColumn.get(); this.colAmount = colSupplier.amountColumn.get(); this.colMixedAmount = colSupplier.mixedAmountColumn.get(); - this.colMinerTxFee = colSupplier.minerTxFeeColumn.get(); this.colMixedTradeFee = colSupplier.mixedTradeFeeColumn.get(); this.colBuyerDeposit = colSupplier.toSecurityDepositColumn.apply(COL_HEADER_BUYER_DEPOSIT); this.colSellerDeposit = colSupplier.toSecurityDepositColumn.apply(COL_HEADER_SELLER_DEPOSIT); @@ -194,12 +191,6 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder { ? format("%.2f%s", t.getOffer().getMarketPriceMarginPct(), "%") : "N/A"; - protected final Function toMyMinerTxFee = (t) -> { - return isTaker.test(t) - ? t.getTxFeeAsLong() - : t.getOffer().getTxFee(); - }; - protected final Function toTradeFeeBtc = (t) -> { var isMyOffer = t.getOffer().getIsMyOffer(); if (isMyOffer) { diff --git a/cli/src/main/java/bisq/cli/table/builder/ClosedTradeTableBuilder.java b/cli/src/main/java/bisq/cli/table/builder/ClosedTradeTableBuilder.java index b7201fdc..89ddf196 100644 --- a/cli/src/main/java/bisq/cli/table/builder/ClosedTradeTableBuilder.java +++ b/cli/src/main/java/bisq/cli/table/builder/ClosedTradeTableBuilder.java @@ -43,7 +43,6 @@ class ClosedTradeTableBuilder extends AbstractTradeListBuilder { colAmount.asStringColumn(), colMixedAmount.justify(), colCurrency, - colMinerTxFee.asStringColumn(), colMixedTradeFee.asStringColumn(), colBuyerDeposit.asStringColumn(), colSellerDeposit.asStringColumn(), @@ -61,7 +60,6 @@ class ClosedTradeTableBuilder extends AbstractTradeListBuilder { colAmount.addRow(t.getAmountAsLong()); colMixedAmount.addRow(t.getTradeVolume()); colCurrency.addRow(toPaymentCurrencyCode.apply(t)); - colMinerTxFee.addRow(toMyMinerTxFee.apply(t)); colMixedTradeFee.addRow(toTradeFeeBtc.apply(t), false); diff --git a/cli/src/main/java/bisq/cli/table/builder/TradeDetailTableBuilder.java b/cli/src/main/java/bisq/cli/table/builder/TradeDetailTableBuilder.java index cd3fbcdb..70be7512 100644 --- a/cli/src/main/java/bisq/cli/table/builder/TradeDetailTableBuilder.java +++ b/cli/src/main/java/bisq/cli/table/builder/TradeDetailTableBuilder.java @@ -63,7 +63,6 @@ class TradeDetailTableBuilder extends AbstractTradeListBuilder { colRole.addRow(trade.getRole()); colPrice.addRow(trade.getPrice()); colAmount.addRow(toTradeAmount.apply(trade)); - colMinerTxFee.addRow(toMyMinerTxFee.apply(trade)); colBisqTradeFee.addRow(toMyMakerOrTakerFee.apply(trade)); colIsDepositPublished.addRow(trade.getIsDepositsPublished()); colIsDepositConfirmed.addRow(trade.getIsDepositsUnlocked()); @@ -86,7 +85,6 @@ class TradeDetailTableBuilder extends AbstractTradeListBuilder { add(colRole); add(colPrice.justify()); add(colAmount.asStringColumn()); - add(colMinerTxFee.asStringColumn()); add(colBisqTradeFee.asStringColumn()); add(colIsDepositPublished.asStringColumn()); add(colIsDepositConfirmed.asStringColumn()); diff --git a/common/src/main/java/bisq/common/persistence/PersistenceManager.java b/common/src/main/java/bisq/common/persistence/PersistenceManager.java index 6b3de1a5..f6f41eea 100644 --- a/common/src/main/java/bisq/common/persistence/PersistenceManager.java +++ b/common/src/main/java/bisq/common/persistence/PersistenceManager.java @@ -457,7 +457,7 @@ public class PersistenceManager { persistNow(completeHandler, false); } - private void persistNow(@Nullable Runnable completeHandler, boolean force) { + private synchronized void persistNow(@Nullable Runnable completeHandler, boolean force) { long ts = System.currentTimeMillis(); try { // The serialisation is done on the user thread to avoid threading issue with potential mutations of the diff --git a/core/src/main/java/bisq/core/api/model/OfferInfo.java b/core/src/main/java/bisq/core/api/model/OfferInfo.java index 32c34f98..45a81bf1 100644 --- a/core/src/main/java/bisq/core/api/model/OfferInfo.java +++ b/core/src/main/java/bisq/core/api/model/OfferInfo.java @@ -156,7 +156,6 @@ public class OfferInfo implements Payload { .withVolume(roundedVolume) .withMinVolume(roundedMinVolume) .withMakerFee(HavenoUtils.centinerosToAtomicUnits(offer.getMakerFee().value).longValueExact()) - .withTxFee(HavenoUtils.centinerosToAtomicUnits(offer.getTxFee().value).longValueExact()) .withOfferFeePaymentTxId(offer.getOfferFeePaymentTxId()) .withBuyerSecurityDeposit(HavenoUtils.centinerosToAtomicUnits(offer.getBuyerSecurityDeposit().value).longValueExact()) .withSellerSecurityDeposit(HavenoUtils.centinerosToAtomicUnits(offer.getSellerSecurityDeposit().value).longValueExact()) diff --git a/core/src/main/java/bisq/core/api/model/TradeInfo.java b/core/src/main/java/bisq/core/api/model/TradeInfo.java index 06b2edc3..4693c860 100644 --- a/core/src/main/java/bisq/core/api/model/TradeInfo.java +++ b/core/src/main/java/bisq/core/api/model/TradeInfo.java @@ -65,7 +65,6 @@ public class TradeInfo implements Payload { private final String shortId; private final long date; private final String role; - private final long txFeeAsLong; private final long takerFeeAsLong; private final String makerDepositTxId; private final String takerDepositTxId; @@ -100,7 +99,6 @@ public class TradeInfo implements Payload { this.shortId = builder.getShortId(); this.date = builder.getDate(); this.role = builder.getRole(); - this.txFeeAsLong = builder.getTxFeeAsLong(); this.takerFeeAsLong = builder.getTakerFeeAsLong(); this.makerDepositTxId = builder.getMakerDepositTxId(); this.takerDepositTxId = builder.getTakerDepositTxId(); @@ -158,7 +156,6 @@ public class TradeInfo implements Payload { .withShortId(trade.getShortId()) .withDate(trade.getDate().getTime()) .withRole(role == null ? "" : role) - .withTxFeeAsLong(trade.getTxFeeAsLong()) .withTakerFeeAsLong(trade.getTakerFeeAsLong()) .withMakerDepositTxId(trade.getMaker().getDepositTxHash()) .withTakerDepositTxId(trade.getTaker().getDepositTxHash()) @@ -202,7 +199,6 @@ public class TradeInfo implements Payload { .setShortId(shortId) .setDate(date) .setRole(role) - .setTxFeeAsLong(txFeeAsLong) .setTakerFeeAsLong(takerFeeAsLong) .setMakerDepositTxId(makerDepositTxId == null ? "" : makerDepositTxId) .setTakerDepositTxId(takerDepositTxId == null ? "" : takerDepositTxId) @@ -240,7 +236,6 @@ public class TradeInfo implements Payload { .withShortId(proto.getShortId()) .withDate(proto.getDate()) .withRole(proto.getRole()) - .withTxFeeAsLong(proto.getTxFeeAsLong()) .withTakerFeeAsLong(proto.getTakerFeeAsLong()) .withMakerDepositTxId(proto.getMakerDepositTxId()) .withTakerDepositTxId(proto.getTakerDepositTxId()) @@ -278,7 +273,6 @@ public class TradeInfo implements Payload { ", shortId='" + shortId + '\'' + "\n" + ", date='" + date + '\'' + "\n" + ", role='" + role + '\'' + "\n" + - ", txFeeAsLong='" + txFeeAsLong + '\'' + "\n" + ", takerFeeAsLong='" + takerFeeAsLong + '\'' + "\n" + ", makerDepositTxId='" + makerDepositTxId + '\'' + "\n" + ", takerDepositTxId='" + takerDepositTxId + '\'' + "\n" + diff --git a/core/src/main/java/bisq/core/offer/CreateOfferService.java b/core/src/main/java/bisq/core/offer/CreateOfferService.java index aabf9105..92a96bdb 100644 --- a/core/src/main/java/bisq/core/offer/CreateOfferService.java +++ b/core/src/main/java/bisq/core/offer/CreateOfferService.java @@ -201,7 +201,6 @@ public class CreateOfferService { acceptedBanks, Version.VERSION, xmrWalletService.getWallet().getHeight(), - 0, // todo: remove txFeeToUse from data model makerFeeAsCoin.value, buyerSecurityDepositAsCoin.value, sellerSecurityDepositAsCoin.value, diff --git a/core/src/main/java/bisq/core/offer/Offer.java b/core/src/main/java/bisq/core/offer/Offer.java index 6077a9a0..7b6d7793 100644 --- a/core/src/main/java/bisq/core/offer/Offer.java +++ b/core/src/main/java/bisq/core/offer/Offer.java @@ -297,11 +297,6 @@ public class Offer implements NetworkPayload, PersistablePayload { return reserveAmount; } - // converted payload properties - public Coin getTxFee() { - return Coin.valueOf(offerPayload.getTxFee()); - } - public Coin getMakerFee() { return Coin.valueOf(offerPayload.getMakerFee()); } diff --git a/core/src/main/java/bisq/core/offer/OfferPayload.java b/core/src/main/java/bisq/core/offer/OfferPayload.java index cb19a87f..c5bead4c 100644 --- a/core/src/main/java/bisq/core/offer/OfferPayload.java +++ b/core/src/main/java/bisq/core/offer/OfferPayload.java @@ -131,7 +131,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay @Nullable private final List acceptedBankIds; private final long blockHeightAtOfferCreation; - private final long txFee; private final long makerFee; private final long buyerSecurityDeposit; private final long sellerSecurityDeposit; @@ -179,7 +178,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay @Nullable List acceptedBankIds, String versionNr, long blockHeightAtOfferCreation, - long txFee, long makerFee, long buyerSecurityDeposit, long sellerSecurityDeposit, @@ -222,7 +220,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay this.bankId = bankId; this.acceptedBankIds = acceptedBankIds; this.blockHeightAtOfferCreation = blockHeightAtOfferCreation; - this.txFee = txFee; this.makerFee = makerFee; this.buyerSecurityDeposit = buyerSecurityDeposit; this.sellerSecurityDeposit = sellerSecurityDeposit; @@ -287,7 +284,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay .setMakerPaymentAccountId(makerPaymentAccountId) .setVersionNr(versionNr) .setBlockHeightAtOfferCreation(blockHeightAtOfferCreation) - .setTxFee(txFee) .setMakerFee(makerFee) .setBuyerSecurityDeposit(buyerSecurityDeposit) .setSellerSecurityDeposit(sellerSecurityDeposit) @@ -343,7 +339,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay acceptedBankIds, proto.getVersionNr(), proto.getBlockHeightAtOfferCreation(), - proto.getTxFee(), proto.getMakerFee(), proto.getBuyerSecurityDeposit(), proto.getSellerSecurityDeposit(), @@ -392,7 +387,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay ",\r\n bankId='" + bankId + '\'' + ",\r\n acceptedBankIds=" + acceptedBankIds + ",\r\n blockHeightAtOfferCreation=" + blockHeightAtOfferCreation + - ",\r\n txFee=" + txFee + ",\r\n makerFee=" + makerFee + ",\r\n buyerSecurityDeposit=" + buyerSecurityDeposit + ",\r\n sellerSecurityDeposit=" + sellerSecurityDeposit + @@ -432,7 +426,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay object.add("offerFeePaymentTxId", context.serialize(offerPayload.getOfferFeePaymentTxId())); object.add("versionNr", context.serialize(offerPayload.getVersionNr())); object.add("blockHeightAtOfferCreation", context.serialize(offerPayload.getBlockHeightAtOfferCreation())); - object.add("txFee", context.serialize(offerPayload.getTxFee())); object.add("makerFee", context.serialize(offerPayload.getMakerFee())); object.add("buyerSecurityDeposit", context.serialize(offerPayload.getBuyerSecurityDeposit())); object.add("sellerSecurityDeposit", context.serialize(offerPayload.getSellerSecurityDeposit())); diff --git a/core/src/main/java/bisq/core/offer/OpenOfferManager.java b/core/src/main/java/bisq/core/offer/OpenOfferManager.java index 9e059e28..d333b89a 100644 --- a/core/src/main/java/bisq/core/offer/OpenOfferManager.java +++ b/core/src/main/java/bisq/core/offer/OpenOfferManager.java @@ -1321,7 +1321,6 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe originalOfferPayload.getAcceptedBankIds(), originalOfferPayload.getVersionNr(), originalOfferPayload.getBlockHeightAtOfferCreation(), - originalOfferPayload.getTxFee(), originalOfferPayload.getMakerFee(), originalOfferPayload.getBuyerSecurityDeposit(), originalOfferPayload.getSellerSecurityDeposit(), diff --git a/core/src/main/java/bisq/core/offer/placeoffer/tasks/ValidateOffer.java b/core/src/main/java/bisq/core/offer/placeoffer/tasks/ValidateOffer.java index 65e61829..bf99b7a2 100644 --- a/core/src/main/java/bisq/core/offer/placeoffer/tasks/ValidateOffer.java +++ b/core/src/main/java/bisq/core/offer/placeoffer/tasks/ValidateOffer.java @@ -84,7 +84,6 @@ public class ValidateOffer extends Task { checkNotNull(offer.getPubKeyRing(), "pubKeyRing is null"); checkNotNull(offer.getMinAmount(), "MinAmount is null"); checkNotNull(offer.getPrice(), "Price is null"); - checkNotNull(offer.getTxFee(), "txFee is null"); checkNotNull(offer.getMakerFee(), "MakerFee is null"); checkNotNull(offer.getVersionNr(), "VersionNr is null"); checkArgument(offer.getMaxTradePeriod() > 0, diff --git a/core/src/main/java/bisq/core/proto/network/CoreNetworkProtoResolver.java b/core/src/main/java/bisq/core/proto/network/CoreNetworkProtoResolver.java index bdf943e9..0e25a7a6 100644 --- a/core/src/main/java/bisq/core/proto/network/CoreNetworkProtoResolver.java +++ b/core/src/main/java/bisq/core/proto/network/CoreNetworkProtoResolver.java @@ -46,7 +46,6 @@ import bisq.core.trade.messages.PaymentReceivedMessage; import bisq.core.trade.messages.RefreshTradeStateRequest; import bisq.core.trade.messages.SignContractRequest; import bisq.core.trade.messages.SignContractResponse; -import bisq.core.trade.messages.TraderSignedWitnessMessage; import bisq.network.p2p.AckMessage; import bisq.network.p2p.BundleOfEnvelopes; @@ -158,9 +157,6 @@ public class CoreNetworkProtoResolver extends CoreProtoResolver implements Netwo case PAYMENT_RECEIVED_MESSAGE: return PaymentReceivedMessage.fromProto(proto.getPaymentReceivedMessage(), messageVersion); - case TRADER_SIGNED_WITNESS_MESSAGE: - return TraderSignedWitnessMessage.fromProto(proto.getTraderSignedWitnessMessage(), messageVersion); - case MEDIATED_PAYOUT_TX_SIGNATURE_MESSAGE: return MediatedPayoutTxSignatureMessage.fromProto(proto.getMediatedPayoutTxSignatureMessage(), messageVersion); case MEDIATED_PAYOUT_TX_PUBLISHED_MESSAGE: diff --git a/core/src/main/java/bisq/core/trade/Trade.java b/core/src/main/java/bisq/core/trade/Trade.java index 97f8f1e6..b398ef96 100644 --- a/core/src/main/java/bisq/core/trade/Trade.java +++ b/core/src/main/java/bisq/core/trade/Trade.java @@ -325,8 +325,6 @@ public abstract class Trade implements Tradable, Model { @Getter private final Offer offer; @Getter - private final long txFeeAsLong; - @Getter private final long takerFeeAsLong; // Added in 1.5.1 @@ -486,7 +484,6 @@ public abstract class Trade implements Tradable, Model { this.processModel = processModel; this.uid = uid; - this.txFeeAsLong = txFee.value; this.takerFeeAsLong = takerFee.value; this.takeOfferDate = new Date().getTime(); this.tradeListeners = new ArrayList(); @@ -830,10 +827,10 @@ public abstract class Trade implements Tradable, Model { isBuyerMakerAndSellerTaker, this instanceof MakerTrade ? processModel.getAccountId() : getMaker().getAccountId(), // maker account id this instanceof TakerTrade ? processModel.getAccountId() : getTaker().getAccountId(), // taker account id - checkNotNull(this instanceof MakerTrade ? processModel.getPaymentAccountPayload(this).getPaymentMethodId() : getOffer().getOfferPayload().getPaymentMethodId()), // maker payment method id - checkNotNull(this instanceof TakerTrade ? processModel.getPaymentAccountPayload(this).getPaymentMethodId() : getTaker().getPaymentMethodId()), // taker payment method id - this instanceof MakerTrade ? processModel.getPaymentAccountPayload(this).getHash() : getMaker().getPaymentAccountPayloadHash(), // maker payment account payload hash - this instanceof TakerTrade ? processModel.getPaymentAccountPayload(this).getHash() : getTaker().getPaymentAccountPayloadHash(), // maker payment account payload hash + checkNotNull(this instanceof MakerTrade ? getMaker().getPaymentAccountPayload().getPaymentMethodId() : getOffer().getOfferPayload().getPaymentMethodId()), + checkNotNull(this instanceof TakerTrade ? getTaker().getPaymentAccountPayload().getPaymentMethodId() : getTaker().getPaymentMethodId()), + this instanceof MakerTrade ? getMaker().getPaymentAccountPayload().getHash() : getMaker().getPaymentAccountPayloadHash(), + this instanceof TakerTrade ? getTaker().getPaymentAccountPayload().getHash() : getTaker().getPaymentAccountPayloadHash(), getMaker().getPubKeyRing(), getTaker().getPubKeyRing(), this instanceof MakerTrade ? xmrWalletService.getAddressEntry(getId(), XmrAddressEntry.Context.TRADE_PAYOUT).get().getAddressString() : getMaker().getPayoutAddressString(), // maker payout address @@ -1219,6 +1216,7 @@ public abstract class Trade implements Tradable, Model { payoutTxId = payoutTx.getHash(); if ("".equals(payoutTxId)) payoutTxId = null; // tx hash is empty until signed payoutTxKey = payoutTx.getKey(); + for (Dispute dispute : getDisputes()) dispute.setDisputePayoutTxId(payoutTxId); } public void setErrorMessage(String errorMessage) { @@ -1751,7 +1749,6 @@ public abstract class Trade implements Tradable, Model { public Message toProtoMessage() { protobuf.Trade.Builder builder = protobuf.Trade.newBuilder() .setOffer(offer.toProtoMessage()) - .setTxFeeAsLong(txFeeAsLong) .setTakerFeeAsLong(takerFeeAsLong) .setTakeOfferDate(takeOfferDate) .setProcessModel(processModel.toProtoMessage()) @@ -1821,7 +1818,6 @@ public abstract class Trade implements Tradable, Model { public String toString() { return "Trade{" + "\n offer=" + offer + - ",\n txFeeAsLong=" + txFeeAsLong + ",\n takerFeeAsLong=" + takerFeeAsLong + ",\n takeOfferDate=" + takeOfferDate + ",\n processModel=" + processModel + diff --git a/core/src/main/java/bisq/core/trade/TradeManager.java b/core/src/main/java/bisq/core/trade/TradeManager.java index 9e4958be..6adc4590 100644 --- a/core/src/main/java/bisq/core/trade/TradeManager.java +++ b/core/src/main/java/bisq/core/trade/TradeManager.java @@ -596,12 +596,10 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi request.getTakerNodeAddress(), request.getArbitratorNodeAddress()); - //System.out.println("TradeManager trade.getTradePeer().setNodeAddress(): " + sender); - //trade.getTradePeer().setNodeAddress(sender); - // TODO (woodser): what if maker's address changes while offer open, or taker's address changes after multisig deposit available? need to verify and update. see OpenOfferManager.maybeUpdatePersistedOffers() trade.getArbitrator().setPubKeyRing(arbitrator.getPubKeyRing()); trade.getMaker().setPubKeyRing(trade.getOffer().getPubKeyRing()); initTradeAndProtocol(trade, getTradeProtocol(trade)); + trade.getSelf().setPaymentAccountId(offer.getOfferPayload().getMakerPaymentAccountId()); trade.getSelf().setReserveTxHash(openOffer.getReserveTxHash()); // TODO (woodser): initialize in initTradeAndProtocol? trade.getSelf().setReserveTxHex(openOffer.getReserveTxHex()); trade.getSelf().setReserveTxKey(openOffer.getReserveTxKey()); @@ -783,8 +781,8 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi trade.getProcessModel().setUseSavingsWallet(useSavingsWallet); trade.getProcessModel().setFundsNeededForTradeAsLong(fundsNeededForTrade.value); trade.getMaker().setPubKeyRing(trade.getOffer().getPubKeyRing()); - trade.getTaker().setPubKeyRing(model.getPubKeyRing()); - trade.getTaker().setPaymentAccountId(paymentAccountId); + trade.getSelf().setPubKeyRing(model.getPubKeyRing()); + trade.getSelf().setPaymentAccountId(paymentAccountId); TradeProtocol tradeProtocol = TradeProtocolFactory.getNewTradeProtocol(trade); TradeProtocol prev = tradeProtocolByTradeId.put(trade.getUid(), tradeProtocol); diff --git a/core/src/main/java/bisq/core/trade/messages/TraderSignedWitnessMessage.java b/core/src/main/java/bisq/core/trade/messages/TraderSignedWitnessMessage.java deleted file mode 100644 index 799dbec0..00000000 --- a/core/src/main/java/bisq/core/trade/messages/TraderSignedWitnessMessage.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This file is part of Haveno. - * - * Haveno is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Haveno is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Haveno. If not, see . - */ - -package bisq.core.trade.messages; - -import bisq.core.account.sign.SignedWitness; - -import bisq.network.p2p.NodeAddress; - -import bisq.common.app.Version; - -import lombok.EqualsAndHashCode; -import lombok.Value; - -/** - * Not used anymore since v1.4.0 - */ -@Deprecated -@SuppressWarnings("ALL") -@EqualsAndHashCode(callSuper = true) -@Value -public class TraderSignedWitnessMessage extends TradeMailboxMessage { - private final NodeAddress senderNodeAddress; - private final SignedWitness signedWitness; - - public TraderSignedWitnessMessage(String uid, - String tradeId, - NodeAddress senderNodeAddress, - SignedWitness signedWitness) { - this(Version.getP2PMessageVersion(), - uid, - tradeId, - senderNodeAddress, - signedWitness); - } - - - /////////////////////////////////////////////////////////////////////////////////////////// - // PROTO BUFFER - /////////////////////////////////////////////////////////////////////////////////////////// - - private TraderSignedWitnessMessage(String messageVersion, - String uid, - String tradeId, - NodeAddress senderNodeAddress, - SignedWitness signedWitness) { - super(messageVersion, tradeId, uid); - this.senderNodeAddress = senderNodeAddress; - this.signedWitness = signedWitness; - } - - @Override - public protobuf.NetworkEnvelope toProtoNetworkEnvelope() { - final protobuf.TraderSignedWitnessMessage.Builder builder = protobuf.TraderSignedWitnessMessage.newBuilder(); - builder.setUid(uid) - .setTradeId(tradeId) - .setSenderNodeAddress(senderNodeAddress.toProtoMessage()) - .setSignedWitness(signedWitness.toProtoSignedWitness()); - return getNetworkEnvelopeBuilder().setTraderSignedWitnessMessage(builder).build(); - } - - public static TraderSignedWitnessMessage fromProto(protobuf.TraderSignedWitnessMessage proto, String messageVersion) { - return new TraderSignedWitnessMessage(messageVersion, - proto.getUid(), - proto.getTradeId(), - NodeAddress.fromProto(proto.getSenderNodeAddress()), - SignedWitness.fromProto(proto.getSignedWitness())); - } - - @Override - public String toString() { - return "TraderSignedWitnessMessage{" + - "\n senderNodeAddress=" + senderNodeAddress + - "\n signedWitness=" + signedWitness + - "\n} " + super.toString(); - } - -} diff --git a/core/src/main/java/bisq/core/trade/protocol/ProcessModel.java b/core/src/main/java/bisq/core/trade/protocol/ProcessModel.java index aefb968f..7c838f99 100644 --- a/core/src/main/java/bisq/core/trade/protocol/ProcessModel.java +++ b/core/src/main/java/bisq/core/trade/protocol/ProcessModel.java @@ -306,12 +306,8 @@ public class ProcessModel implements Model, PersistablePayload { } @Nullable - public PaymentAccountPayload getPaymentAccountPayload(Trade trade) { - PaymentAccount paymentAccount; - if (trade instanceof MakerTrade) - paymentAccount = getUser().getPaymentAccount(offer.getMakerPaymentAccountId()); - else - paymentAccount = getUser().getPaymentAccount(trade.getTaker().getPaymentAccountId()); + public PaymentAccountPayload getPaymentAccountPayload(String paymentAccountId) { + PaymentAccount paymentAccount = getUser().getPaymentAccount(paymentAccountId); return paymentAccount != null ? paymentAccount.getPaymentAccountPayload() : null; } diff --git a/core/src/main/java/bisq/core/trade/protocol/tasks/MaybeSendSignContractRequest.java b/core/src/main/java/bisq/core/trade/protocol/tasks/MaybeSendSignContractRequest.java index c0f088ea..59ec3b0e 100644 --- a/core/src/main/java/bisq/core/trade/protocol/tasks/MaybeSendSignContractRequest.java +++ b/core/src/main/java/bisq/core/trade/protocol/tasks/MaybeSendSignContractRequest.java @@ -87,7 +87,7 @@ public class MaybeSendSignContractRequest extends TradeTask { trade.getSelf().setDepositTxHash(depositTx.getHash()); trade.getSelf().setReserveTxKeyImages(reservedKeyImages); trade.getSelf().setPayoutAddressString(trade.getXmrWalletService().getAddressEntry(processModel.getOffer().getId(), XmrAddressEntry.Context.TRADE_PAYOUT).get().getAddressString()); // TODO (woodser): allow custom payout address? - trade.getSelf().setPaymentAccountPayload(trade.getProcessModel().getPaymentAccountPayload(trade)); + trade.getSelf().setPaymentAccountPayload(trade.getProcessModel().getPaymentAccountPayload(trade.getSelf().getPaymentAccountId())); // maker signs deposit hash nonce to avoid challenge protocol byte[] sig = null; diff --git a/core/src/test/java/bisq/core/offer/OfferMaker.java b/core/src/test/java/bisq/core/offer/OfferMaker.java index ce7972d2..791004cb 100644 --- a/core/src/test/java/bisq/core/offer/OfferMaker.java +++ b/core/src/test/java/bisq/core/offer/OfferMaker.java @@ -62,7 +62,6 @@ public class OfferMaker { 0L, 0L, 0L, - 0L, false, false, 0L, diff --git a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java index aa771e4d..839a11bd 100644 --- a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java +++ b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java @@ -204,7 +204,7 @@ public class OfferBookChartView extends ActivatableViewAndModel updateChartData()); } }); @@ -290,7 +290,7 @@ public class OfferBookChartView extends ActivatableViewAndModel updateChartData(); + changeListener = c -> UserThread.execute(() -> updateChartData()); currencyListItemsListener = c -> { if (model.getSelectedCurrencyListItem().isPresent()) @@ -353,17 +353,15 @@ public class OfferBookChartView extends ActivatableViewAndModel { - seriesBuy.getData().clear(); - seriesSell.getData().clear(); - areaChart.getData().clear(); + private synchronized void updateChartData() { + seriesBuy.getData().clear(); + seriesSell.getData().clear(); + areaChart.getData().clear(); - seriesBuy.getData().addAll(filterOutliersBuy(model.getBuyData())); - seriesSell.getData().addAll(filterOutliersSell(model.getSellData())); + seriesBuy.getData().addAll(filterOutliersBuy(model.getBuyData())); + seriesSell.getData().addAll(filterOutliersSell(model.getSellData())); - areaChart.getData().addAll(List.of(seriesBuy, seriesSell)); - }); + areaChart.getData().addAll(List.of(seriesBuy, seriesSell)); } List> filterOutliersBuy(List> buy) { diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java index 063578a9..81128f68 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java @@ -223,11 +223,6 @@ public class TradeDetailsWindow extends Overlay { formatter.formatCoinWithCode(offer.getSellerSecurityDeposit()); addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit); - String txFee = Res.get("shared.makerTxFee", formatter.formatCoinWithCode(offer.getTxFee())) + - " / " + - Res.get("shared.takerTxFee", formatter.formatCoinWithCode(trade.getTxFee().multiply(3))); - addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.txFee"), txFee); - NodeAddress arbitratorNodeAddress = trade.getArbitratorNodeAddress(); if (arbitratorNodeAddress != null) { addConfirmationLabelTextField(gridPane, ++rowIndex, diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java index 47a8f109..f6faeaf0 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java @@ -127,7 +127,7 @@ public class ClosedTradesView extends ActivatableViewAndModel tableView; @FXML TableColumn priceColumn, deviationColumn, amountColumn, volumeColumn, - txFeeColumn, tradeFeeColumn, buyerSecurityDepositColumn, sellerSecurityDepositColumn, + tradeFeeColumn, buyerSecurityDepositColumn, sellerSecurityDepositColumn, marketColumn, directionColumn, dateColumn, tradeIdColumn, stateColumn, duplicateColumn, avatarColumn; @FXML @@ -171,7 +171,6 @@ public class ClosedTradesView extends ActivatableViewAndModel onWidthChange((double) newValue); - txFeeColumn.setGraphic(new AutoTooltipLabel(ColumnNames.TX_FEE.toString())); tradeFeeColumn.setGraphic(new AutoTooltipLabel(ColumnNames.TRADE_FEE_BTC.toString().replace(" BTC", ""))); buyerSecurityDepositColumn.setGraphic(new AutoTooltipLabel(ColumnNames.BUYER_SEC.toString())); sellerSecurityDepositColumn.setGraphic(new AutoTooltipLabel(ColumnNames.SELLER_SEC.toString())); @@ -194,7 +193,6 @@ public class ClosedTradesView extends ActivatableViewAndModel - o.getTradable() instanceof Trade ? ((Trade) o.getTradable()).getTxFee() : o.getTradable().getOffer().getTxFee() - )); - txFeeColumn.setComparator(Comparator.comparing(ClosedTradesListItem::getTxFeeAsString, Comparator.nullsFirst(Comparator.naturalOrder()))); // tradeFeeColumn.setComparator(Comparator.comparing(item -> { @@ -342,8 +336,6 @@ public class ClosedTradesView extends ActivatableViewAndModel 1200); - tradeFeeColumn.setVisible(width > 1300); buyerSecurityDepositColumn.setVisible(width > 1400); sellerSecurityDepositColumn.setVisible(width > 1500); } @@ -632,28 +624,6 @@ public class ClosedTradesView extends ActivatableViewAndModel new ReadOnlyObjectWrapper<>(item.getValue())); - txFeeColumn.setCellFactory( - new Callback<>() { - @Override - public TableCell call( - TableColumn column) { - return new TableCell<>() { - @Override - public void updateItem(final ClosedTradesListItem item, boolean empty) { - super.updateItem(item, empty); - if (item != null && !empty) { - setGraphic(new AutoTooltipLabel(item.getTxFeeAsString())); - } else { - setGraphic(null); - } - } - }; - } - }); - } - private void setTradeFeeColumnCellFactory() { tradeFeeColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue())); tradeFeeColumn.setCellFactory( diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java index f56f2a63..47b1dd78 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java @@ -204,7 +204,6 @@ class EditOfferDataModel extends MutableOfferDataModel { newOfferPayload.getAcceptedBankIds(), offerPayload.getVersionNr(), offerPayload.getBlockHeightAtOfferCreation(), - offerPayload.getTxFee(), offerPayload.getMakerFee(), offerPayload.getBuyerSecurityDeposit(), offerPayload.getSellerSecurityDeposit(), diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java index ee76a91e..e72aaf61 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java @@ -294,26 +294,6 @@ public class PendingTradesDataModel extends ActivatableDataModel { } } - Coin getTxFee() { - Trade trade = getTrade(); - if (trade != null) { - if (isMaker()) { - Offer offer = trade.getOffer(); - if (offer != null) { - return offer.getTxFee(); - } else { - log.error("offer is null"); - return Coin.ZERO; - } - } else { - return trade.getTxFee().multiply(3); - } - } else { - log.error("Trade is null at getTotalFees"); - return Coin.ZERO; - } - } - @Nullable public PaymentAccountPayload getSellersPaymentAccountPayload() { if (getTrade() == null) return null; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java index 4fa7cd1f..e125f924 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java @@ -292,18 +292,6 @@ public class PendingTradesViewModel extends ActivatableWithDataModel extra_data = 34; - int32 protocol_version = 35; + int64 maker_fee = 22; + int64 buyer_security_deposit = 23; + int64 seller_security_deposit = 24; + int64 max_trade_limit = 25; + int64 max_trade_period = 26; + bool use_auto_close = 27; + bool use_re_open_after_auto_close = 28; + int64 lower_close_price = 29; + int64 upper_close_price = 30; + bool is_private_offer = 31; + string hash_of_challenge = 32; + map extra_data = 33; + int32 protocol_version = 34; NodeAddress arbitrator_signer = 1001; string arbitrator_signature = 1002; @@ -1634,7 +1624,6 @@ message Trade { string payout_tx_hex = 4; string payout_tx_key = 5; int64 amount_as_long = 6; - int64 tx_fee_as_long = 7; int64 taker_fee_as_long = 8; int64 take_offer_date = 9; int64 price = 10;