From 9c5d0702baf0bc153d15617b889ca895154341fe Mon Sep 17 00:00:00 2001 From: woodser Date: Wed, 16 Aug 2023 07:37:59 -0400 Subject: [PATCH] remove offerFeeTxId from models --- .../java/haveno/core/api/model/OfferInfo.java | 6 -- .../api/model/builder/OfferInfoBuilder.java | 6 -- .../java/haveno/core/app/HavenoSetup.java | 20 ------ .../java/haveno/core/app/WalletAppSetup.java | 19 ----- .../haveno/core/offer/CreateOfferService.java | 1 - .../main/java/haveno/core/offer/Offer.java | 8 --- .../java/haveno/core/offer/OfferPayload.java | 12 ---- .../java/haveno/core/offer/OfferUtil.java | 58 --------------- .../haveno/core/offer/OpenOfferManager.java | 1 - .../core/trade/protocol/ProcessModel.java | 17 ----- .../tasks/TakerVerifyMakerFeePayment.java | 44 ------------ .../java/haveno/core/offer/OfferMaker.java | 1 - .../haveno/desktop/main/debug/DebugView.java | 6 -- .../TransactionAwareOpenOffer.java | 15 ++-- .../transactions/TransactionAwareTrade.java | 16 +---- .../transactions/TransactionsListItem.java | 5 +- .../editoffer/EditOfferDataModel.java | 1 - .../failedtrades/FailedTradesView.java | 3 - .../portfolio/openoffer/OpenOffersView.java | 3 - .../util/filtering/FilteringUtils.java | 2 +- .../TransactionAwareTradeTest.java | 6 -- .../trades/TradesChartsViewModelTest.java | 1 - .../offerbook/OfferBookViewModelTest.java | 1 - .../java/haveno/desktop/maker/OfferMaker.java | 2 - proto/src/main/proto/grpc.proto | 17 +++-- proto/src/main/proto/pb.proto | 72 +++++++++---------- 26 files changed, 53 insertions(+), 290 deletions(-) delete mode 100644 core/src/main/java/haveno/core/trade/protocol/tasks/TakerVerifyMakerFeePayment.java diff --git a/core/src/main/java/haveno/core/api/model/OfferInfo.java b/core/src/main/java/haveno/core/api/model/OfferInfo.java index a02bbe0c..cb8f3d28 100644 --- a/core/src/main/java/haveno/core/api/model/OfferInfo.java +++ b/core/src/main/java/haveno/core/api/model/OfferInfo.java @@ -18,7 +18,6 @@ package haveno.core.api.model; import haveno.common.Payload; -import haveno.common.proto.ProtoUtil; import haveno.core.api.model.builder.OfferInfoBuilder; import haveno.core.monetary.Price; import haveno.core.offer.Offer; @@ -55,7 +54,6 @@ public class OfferInfo implements Payload { private final String minVolume; private final long makerFee; @Nullable - private final String offerFeeTxId; private final long buyerSecurityDeposit; private final long sellerSecurityDeposit; private final String triggerPrice; @@ -88,7 +86,6 @@ public class OfferInfo implements Payload { this.volume = builder.getVolume(); this.minVolume = builder.getMinVolume(); this.makerFee = builder.getMakerFee(); - this.offerFeeTxId = builder.getOfferFeeTxId(); this.buyerSecurityDeposit = builder.getBuyerSecurityDeposit(); this.sellerSecurityDeposit = builder.getSellerSecurityDeposit(); this.triggerPrice = builder.getTriggerPrice(); @@ -154,7 +151,6 @@ public class OfferInfo implements Payload { .withVolume(roundedVolume) .withMinVolume(roundedMinVolume) .withMakerFee(offer.getMakerFee().longValueExact()) - .withOfferFeeTxId(offer.getOfferFeeTxId()) .withBuyerSecurityDeposit(offer.getBuyerSecurityDeposit().longValueExact()) .withSellerSecurityDeposit(offer.getSellerSecurityDeposit().longValueExact()) .withPaymentAccountId(offer.getMakerPaymentAccountId()) @@ -205,7 +201,6 @@ public class OfferInfo implements Payload { .setVersionNr(versionNumber) .setProtocolVersion(protocolVersion); Optional.ofNullable(arbitratorSigner).ifPresent(builder::setArbitratorSigner); - Optional.ofNullable(offerFeeTxId).ifPresent(builder::setOfferFeeTxId); return builder.build(); } @@ -222,7 +217,6 @@ public class OfferInfo implements Payload { .withVolume(proto.getVolume()) .withMinVolume(proto.getMinVolume()) .withMakerFee(proto.getMakerFee()) - .withOfferFeeTxId(ProtoUtil.stringOrNullFromProto(proto.getOfferFeeTxId())) .withBuyerSecurityDeposit(proto.getBuyerSecurityDeposit()) .withSellerSecurityDeposit(proto.getSellerSecurityDeposit()) .withTriggerPrice(proto.getTriggerPrice()) diff --git a/core/src/main/java/haveno/core/api/model/builder/OfferInfoBuilder.java b/core/src/main/java/haveno/core/api/model/builder/OfferInfoBuilder.java index f183ff8a..2cce4aaa 100644 --- a/core/src/main/java/haveno/core/api/model/builder/OfferInfoBuilder.java +++ b/core/src/main/java/haveno/core/api/model/builder/OfferInfoBuilder.java @@ -39,7 +39,6 @@ public final class OfferInfoBuilder { private String volume; private String minVolume; private long makerFee; - private String offerFeeTxId; private long buyerSecurityDeposit; private long sellerSecurityDeposit; private String triggerPrice; @@ -111,11 +110,6 @@ public final class OfferInfoBuilder { return this; } - public OfferInfoBuilder withOfferFeeTxId(String offerFeeTxId) { - this.offerFeeTxId = offerFeeTxId; - return this; - } - public OfferInfoBuilder withBuyerSecurityDeposit(long buyerSecurityDeposit) { this.buyerSecurityDeposit = buyerSecurityDeposit; return this; diff --git a/core/src/main/java/haveno/core/app/HavenoSetup.java b/core/src/main/java/haveno/core/app/HavenoSetup.java index a93cea8a..4b84d307 100644 --- a/core/src/main/java/haveno/core/app/HavenoSetup.java +++ b/core/src/main/java/haveno/core/app/HavenoSetup.java @@ -423,7 +423,6 @@ public class HavenoSetup { () -> { if (allBasicServicesInitialized) { checkForLockedUpFunds(); - checkForInvalidMakerFeeTxs(); } }, () -> {}); @@ -440,7 +439,6 @@ public class HavenoSetup { if (walletsSetup.downloadPercentageProperty().get() == 1) { // TODO: update for XMR checkForLockedUpFunds(); - checkForInvalidMakerFeeTxs(); } alertManager.alertMessageProperty().addListener((observable, oldValue, newValue) -> @@ -483,24 +481,6 @@ public class HavenoSetup { } } - private void checkForInvalidMakerFeeTxs() { - // We check if we have open offers with no confidence object at the maker fee tx. That can happen if the - // miner fee was too low and the transaction got removed from mempool and got out from our wallet after a - // resync. - // TODO (woodser): check for invalid maker fee txs with xmr? -// openOfferManager.getObservableList().forEach(e -> { -// String offerFeeTxId = e.getOffer().getOfferFeeTxId(); -// if (btcWalletService.getConfidenceForTxId(offerFeeTxId) == null) { // TODO (woodser): verify xmr maker fee tx -// String message = Res.get("popup.warning.openOfferWithInvalidMakerFeeTx", -// e.getOffer().getShortId(), offerFeeTxId); -// log.warn(message); -// if (lockedUpFundsHandler != null) { -// lockedUpFundsHandler.accept(message); -// } -// } -// }); - } - @Nullable public static String getLastHavenoVersion() { File versionFile = getVersionFile(); diff --git a/core/src/main/java/haveno/core/app/WalletAppSetup.java b/core/src/main/java/haveno/core/app/WalletAppSetup.java index c0399329..4434e83a 100644 --- a/core/src/main/java/haveno/core/app/WalletAppSetup.java +++ b/core/src/main/java/haveno/core/app/WalletAppSetup.java @@ -206,21 +206,6 @@ public class WalletAppSetup { log.warn("We handle that reject message as it is likely critical."); UserThread.runAfter(() -> { String txId = newValue.getTxId(); - openOfferManager.getObservableList().stream() - .filter(openOffer -> txId.equals(openOffer.getOffer().getOfferFeeTxId())) - .forEach(openOffer -> { - // We delay to avoid concurrent modification exceptions - UserThread.runAfter(() -> { - openOffer.getOffer().setErrorMessage(newValue.getMessage()); - if (rejectedTxErrorMessageHandler != null) { - rejectedTxErrorMessageHandler.accept(Res.get("popup.warning.openOffer.makerFeeTxRejected", openOffer.getId(), txId)); - } - openOfferManager.cancelOpenOffer(openOffer, () -> { - log.warn("We removed an open offer because the maker fee was rejected by the Bitcoin " + - "network. OfferId={}, txId={}", openOffer.getShortId(), txId); - }, log::warn); - }, 1); - }); tradeManager.getObservableList().stream() .filter(trade -> trade.getOffer() != null) @@ -231,11 +216,7 @@ public class WalletAppSetup { } if (txId.equals(trade.getTaker().getDepositTxHash())) { details = Res.get("popup.warning.trade.txRejected.deposit"); - } - if (txId.equals(trade.getOffer().getOfferFeeTxId())) { - details = Res.get("popup.warning.trade.txRejected.tradeFee"); } - if (details != null) { // We delay to avoid concurrent modification exceptions String finalDetails = details; diff --git a/core/src/main/java/haveno/core/offer/CreateOfferService.java b/core/src/main/java/haveno/core/offer/CreateOfferService.java index 2b607360..448a7ef2 100644 --- a/core/src/main/java/haveno/core/offer/CreateOfferService.java +++ b/core/src/main/java/haveno/core/offer/CreateOfferService.java @@ -193,7 +193,6 @@ public class CreateOfferService { counterCurrencyCode, paymentAccount.getPaymentMethod().getId(), paymentAccount.getId(), - null, countryCode, acceptedCountryCodes, bankId, diff --git a/core/src/main/java/haveno/core/offer/Offer.java b/core/src/main/java/haveno/core/offer/Offer.java index 1f3b55fd..488ef3bd 100644 --- a/core/src/main/java/haveno/core/offer/Offer.java +++ b/core/src/main/java/haveno/core/offer/Offer.java @@ -268,10 +268,6 @@ public class Offer implements NetworkPayload, PersistablePayload { return stateProperty; } - public void setOfferFeeTxId(String offerFeeTxId) { - offerPayload.setOfferFeeTxId(offerFeeTxId); - } - public void setErrorMessage(String errorMessage) { this.errorMessageProperty.set(errorMessage); } @@ -477,10 +473,6 @@ public class Offer implements NetworkPayload, PersistablePayload { return offerPayload.getMakerPaymentAccountId(); } - public String getOfferFeeTxId() { - return offerPayload.getOfferFeeTxId(); - } - public String getVersionNr() { return offerPayload.getVersionNr(); } diff --git a/core/src/main/java/haveno/core/offer/OfferPayload.java b/core/src/main/java/haveno/core/offer/OfferPayload.java index 79db5ae3..ae8296e1 100644 --- a/core/src/main/java/haveno/core/offer/OfferPayload.java +++ b/core/src/main/java/haveno/core/offer/OfferPayload.java @@ -120,9 +120,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay private final boolean useMarketBasedPrice; // Mutable property. Has to be set before offer is saved in P2P network as it changes the payload hash! - @Setter - @Nullable - private String offerFeeTxId; @Nullable private final String countryCode; @Nullable @@ -172,7 +169,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay String counterCurrencyCode, String paymentMethodId, String makerPaymentAccountId, - @Nullable String offerFeeTxId, @Nullable String countryCode, @Nullable List acceptedCountryCodes, @Nullable String bankId, @@ -215,7 +211,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay this.reserveTxKeyImages = reserveTxKeyImages; this.marketPriceMarginPct = marketPriceMarginPct; this.useMarketBasedPrice = useMarketBasedPrice; - this.offerFeeTxId = offerFeeTxId; this.countryCode = countryCode; this.acceptedCountryCodes = acceptedCountryCodes; this.bankId = bankId; @@ -236,8 +231,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay public byte[] getHash() { if (this.hash == null) { - // A proto message can be created only after the offerFeeTxId is - // set to a non-null value; now is the time to cache the payload hash. this.hash = Hash.getSha256Hash(this.toProtoMessage().toByteArray()); } return this.hash; @@ -261,7 +254,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay counterCurrencyCode, paymentMethodId, makerPaymentAccountId, - offerFeeTxId, countryCode, acceptedCountryCodes, bankId, @@ -342,7 +334,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay .setIsPrivateOffer(isPrivateOffer) .setProtocolVersion(protocolVersion); Optional.ofNullable(ownerNodeAddress).ifPresent(e -> builder.setOwnerNodeAddress(ownerNodeAddress.toProtoMessage())); - Optional.ofNullable(offerFeeTxId).ifPresent(builder::setOfferFeeTxId); Optional.ofNullable(countryCode).ifPresent(builder::setCountryCode); Optional.ofNullable(bankId).ifPresent(builder::setBankId); Optional.ofNullable(acceptedBankIds).ifPresent(builder::addAllAcceptedBankIds); @@ -379,7 +370,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay proto.getCounterCurrencyCode(), proto.getPaymentMethodId(), proto.getMakerPaymentAccountId(), - ProtoUtil.stringOrNullFromProto(proto.getOfferFeeTxId()), ProtoUtil.stringOrNullFromProto(proto.getCountryCode()), acceptedCountryCodes, ProtoUtil.stringOrNullFromProto(proto.getBankId()), @@ -426,7 +416,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay ",\r\n reserveTxKeyImages=" + reserveTxKeyImages + ",\r\n marketPriceMargin=" + marketPriceMarginPct + ",\r\n useMarketBasedPrice=" + useMarketBasedPrice + - ",\r\n offerFeeTxId='" + offerFeeTxId + '\'' + ",\r\n countryCode='" + countryCode + '\'' + ",\r\n acceptedCountryCodes=" + acceptedCountryCodes + ",\r\n bankId='" + bankId + '\'' + @@ -468,7 +457,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay object.add("counterCurrencyCode", context.serialize(offerPayload.getCounterCurrencyCode())); object.add("paymentMethodId", context.serialize(offerPayload.getPaymentMethodId())); object.add("makerPaymentAccountId", context.serialize(offerPayload.getMakerPaymentAccountId())); - object.add("offerFeeTxId", context.serialize(offerPayload.getOfferFeeTxId())); object.add("versionNr", context.serialize(offerPayload.getVersionNr())); object.add("blockHeightAtOfferCreation", context.serialize(offerPayload.getBlockHeightAtOfferCreation())); object.add("makerFee", context.serialize(offerPayload.getMakerFee())); diff --git a/core/src/main/java/haveno/core/offer/OfferUtil.java b/core/src/main/java/haveno/core/offer/OfferUtil.java index 64e9f9b2..ac877977 100644 --- a/core/src/main/java/haveno/core/offer/OfferUtil.java +++ b/core/src/main/java/haveno/core/offer/OfferUtil.java @@ -37,12 +37,8 @@ import haveno.core.trade.statistics.ReferralIdService; import haveno.core.user.AutoConfirmSettings; import haveno.core.user.Preferences; import haveno.core.util.coin.CoinFormatter; -import haveno.core.xmr.wallet.BtcWalletService; import haveno.network.p2p.P2PService; import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Transaction; -import org.bitcoinj.core.TransactionInput; -import org.bitcoinj.core.TransactionOutput; import javax.inject.Inject; import javax.inject.Singleton; @@ -251,58 +247,4 @@ public class OfferUtil { public static boolean isCryptoOffer(Offer offer) { return offer.getCounterCurrencyCode().equals("XMR"); } - - public static Optional getInvalidMakerFeeTxErrorMessage(Offer offer, BtcWalletService btcWalletService) { - String offerFeeTxId = offer.getOfferFeeTxId(); - if (offerFeeTxId == null) { - return Optional.empty(); - } - - Transaction makerFeeTx = btcWalletService.getTransaction(offerFeeTxId); - if (makerFeeTx == null) { - return Optional.empty(); - } - - String errorMsg = null; - String header = "The offer with offer ID '" + offer.getShortId() + - "' has an invalid maker fee transaction.\n\n"; - String spendingTransaction = null; - String extraString = "\nYou have to remove that offer to avoid failed trades.\n" + - "If this happened because of a bug please contact the Haveno developers " + - "and you can request reimbursement for the lost maker fee."; - if (makerFeeTx.getOutputs().size() > 1) { - // Our output to fund the deposit tx is at index 1 - TransactionOutput output = makerFeeTx.getOutput(1); - TransactionInput spentByTransactionInput = output.getSpentBy(); - if (spentByTransactionInput != null) { - spendingTransaction = spentByTransactionInput.getConnectedTransaction() != null ? - spentByTransactionInput.getConnectedTransaction().toString() : - "null"; - // We this is an exceptional case we do not translate that error msg. - errorMsg = "The output of the maker fee tx is already spent.\n" + - extraString + - "\n\nTransaction input which spent the reserved funds for that offer: '" + - spentByTransactionInput.getConnectedTransaction().getTxId().toString() + ":" + - (spentByTransactionInput.getConnectedOutput() != null ? - spentByTransactionInput.getConnectedOutput().getIndex() + "'" : - "null'"); - log.error("spentByTransactionInput {}", spentByTransactionInput); - } - } else { - errorMsg = "The maker fee tx is invalid as it does not has at least 2 outputs." + extraString + - "\nMakerFeeTx=" + makerFeeTx.toString(); - } - - if (errorMsg == null) { - return Optional.empty(); - } - - errorMsg = header + errorMsg; - log.error(errorMsg); - if (spendingTransaction != null) { - log.error("Spending transaction: {}", spendingTransaction); - } - - return Optional.of(errorMsg); - } } diff --git a/core/src/main/java/haveno/core/offer/OpenOfferManager.java b/core/src/main/java/haveno/core/offer/OpenOfferManager.java index e0d9a4de..d9b0cadd 100644 --- a/core/src/main/java/haveno/core/offer/OpenOfferManager.java +++ b/core/src/main/java/haveno/core/offer/OpenOfferManager.java @@ -1494,7 +1494,6 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe originalOfferPayload.getCounterCurrencyCode(), originalOfferPayload.getPaymentMethodId(), originalOfferPayload.getMakerPaymentAccountId(), - originalOfferPayload.getOfferFeeTxId(), originalOfferPayload.getCountryCode(), originalOfferPayload.getAcceptedCountryCodes(), originalOfferPayload.getBankId(), diff --git a/core/src/main/java/haveno/core/trade/protocol/ProcessModel.java b/core/src/main/java/haveno/core/trade/protocol/ProcessModel.java index 152e34ba..aae3b75b 100644 --- a/core/src/main/java/haveno/core/trade/protocol/ProcessModel.java +++ b/core/src/main/java/haveno/core/trade/protocol/ProcessModel.java @@ -98,9 +98,6 @@ public class ProcessModel implements Model, PersistablePayload { // Persistable Mutable @Nullable @Setter - private String takeOfferFeeTxId; - @Nullable - @Setter private byte[] payoutTxSignature; @Nullable @Setter @@ -207,7 +204,6 @@ public class ProcessModel implements Model, PersistablePayload { Optional.ofNullable(maker).ifPresent(e -> builder.setMaker((protobuf.TradePeer) maker.toProtoMessage())); Optional.ofNullable(taker).ifPresent(e -> builder.setTaker((protobuf.TradePeer) taker.toProtoMessage())); Optional.ofNullable(arbitrator).ifPresent(e -> builder.setArbitrator((protobuf.TradePeer) arbitrator.toProtoMessage())); - Optional.ofNullable(takeOfferFeeTxId).ifPresent(builder::setTakeOfferFeeTxId); Optional.ofNullable(payoutTxSignature).ifPresent(e -> builder.setPayoutTxSignature(ByteString.copyFrom(payoutTxSignature))); Optional.ofNullable(tempTradePeerNodeAddress).ifPresent(e -> builder.setTempTradePeerNodeAddress(tempTradePeerNodeAddress.toProtoMessage())); Optional.ofNullable(mediatedPayoutTxSignature).ifPresent(e -> builder.setMediatedPayoutTxSignature(ByteString.copyFrom(e))); @@ -231,7 +227,6 @@ public class ProcessModel implements Model, PersistablePayload { processModel.setSellerPayoutAmountFromMediation(proto.getSellerPayoutAmountFromMediation()); // nullable - processModel.setTakeOfferFeeTxId(ProtoUtil.stringOrNullFromProto(proto.getTakeOfferFeeTxId())); processModel.setPayoutTxSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getPayoutTxSignature())); processModel.setTempTradePeerNodeAddress(proto.hasTempTradePeerNodeAddress() ? NodeAddress.fromProto(proto.getTempTradePeerNodeAddress()) : null); processModel.setMediatedPayoutTxSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getMediatedPayoutTxSignature())); @@ -257,11 +252,6 @@ public class ProcessModel implements Model, PersistablePayload { public void onComplete() { } - public void setTakeOfferFeeTx(MoneroTxWallet takeOfferFeeTx) { - this.takeOfferFeeTx = takeOfferFeeTx; - takeOfferFeeTxId = takeOfferFeeTx.getHash(); - } - @Nullable public PaymentAccountPayload getPaymentAccountPayload(String paymentAccountId) { PaymentAccount paymentAccount = getUser().getPaymentAccount(paymentAccountId); @@ -272,13 +262,6 @@ public class ProcessModel implements Model, PersistablePayload { return Coin.valueOf(fundsNeededForTrade); } - public MoneroTxWallet resolveTakeOfferFeeTx(Trade trade) { - if (takeOfferFeeTx == null) { - takeOfferFeeTx = provider.getXmrWalletService().getWallet().getTx(takeOfferFeeTxId); - } - return takeOfferFeeTx; - } - public NodeAddress getMyNodeAddress() { return getP2PService().getAddress(); } diff --git a/core/src/main/java/haveno/core/trade/protocol/tasks/TakerVerifyMakerFeePayment.java b/core/src/main/java/haveno/core/trade/protocol/tasks/TakerVerifyMakerFeePayment.java deleted file mode 100644 index 2952d1b0..00000000 --- a/core/src/main/java/haveno/core/trade/protocol/tasks/TakerVerifyMakerFeePayment.java +++ /dev/null @@ -1,44 +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 haveno.core.trade.protocol.tasks; - -import haveno.common.taskrunner.TaskRunner; -import haveno.core.trade.Trade; -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class TakerVerifyMakerFeePayment extends TradeTask { - public TakerVerifyMakerFeePayment(TaskRunner taskHandler, Trade trade) { - super(taskHandler, trade); - } - - @Override - protected void run() { - try { - runInterceptHook(); - //TODO impl. missing - // int numOfPeersSeenTx = processModel.getWalletService().getNumOfPeersSeenTx(processModel.getTakeOfferFeeTxId().getHashAsString()); - /* if (numOfPeersSeenTx > 2) { - resultHandler.handleResult(); - }*/ - complete(); - } catch (Throwable t) { - failed(t); - } - } -} diff --git a/core/src/test/java/haveno/core/offer/OfferMaker.java b/core/src/test/java/haveno/core/offer/OfferMaker.java index 9c9b0e96..78314214 100644 --- a/core/src/test/java/haveno/core/offer/OfferMaker.java +++ b/core/src/test/java/haveno/core/offer/OfferMaker.java @@ -54,7 +54,6 @@ public class OfferMaker { null, null, null, - null, "", 0L, 0L, diff --git a/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java b/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java index 40532baf..9a3319d4 100644 --- a/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java +++ b/desktop/src/main/java/haveno/desktop/main/debug/DebugView.java @@ -35,7 +35,6 @@ import haveno.core.trade.protocol.tasks.SellerPreparePaymentReceivedMessage; import haveno.core.trade.protocol.tasks.SellerPublishDepositTx; import haveno.core.trade.protocol.tasks.SellerPublishTradeStatistics; import haveno.core.trade.protocol.tasks.SellerSendPaymentReceivedMessageToBuyer; -import haveno.core.trade.protocol.tasks.TakerVerifyMakerFeePayment; import haveno.core.trade.protocol.tasks.VerifyPeersAccountAgeWitness; import haveno.desktop.common.view.FxmlView; import haveno.desktop.common.view.InitializableView; @@ -85,7 +84,6 @@ public class DebugView extends InitializableView { addGroup("SellerAsTakerProtocol", FXCollections.observableArrayList(Arrays.asList( ApplyFilter.class, - TakerVerifyMakerFeePayment.class, ApplyFilter.class, VerifyPeersAccountAgeWitness.class, @@ -96,10 +94,8 @@ public class DebugView extends InitializableView { ProcessPaymentSentMessage.class, ApplyFilter.class, - TakerVerifyMakerFeePayment.class, ApplyFilter.class, - TakerVerifyMakerFeePayment.class, SellerPreparePaymentReceivedMessage.class, //SellerBroadcastPayoutTx.class, // TODO (woodser): removed from main pipeline; debug view? SellerSendPaymentReceivedMessageToBuyer.class @@ -126,13 +122,11 @@ public class DebugView extends InitializableView { addGroup("BuyerAsTakerProtocol", FXCollections.observableArrayList(Arrays.asList( ApplyFilter.class, - TakerVerifyMakerFeePayment.class, ApplyFilter.class, VerifyPeersAccountAgeWitness.class, ApplyFilter.class, - TakerVerifyMakerFeePayment.class, BuyerPreparePaymentSentMessage.class, BuyerSendPaymentSentMessage.class, diff --git a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareOpenOffer.java b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareOpenOffer.java index 734b6b34..27b7990c 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareOpenOffer.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareOpenOffer.java @@ -17,28 +17,25 @@ package haveno.desktop.main.funds.transactions; -import haveno.core.offer.Offer; import haveno.core.offer.OpenOffer; import haveno.core.trade.Tradable; import monero.wallet.model.MoneroTxWallet; class TransactionAwareOpenOffer implements TransactionAwareTradable { - private final OpenOffer delegate; + private final OpenOffer openOffer; TransactionAwareOpenOffer(OpenOffer delegate) { - this.delegate = delegate; + this.openOffer = delegate; } + @Override public boolean isRelatedToTransaction(MoneroTxWallet transaction) { - Offer offer = delegate.getOffer(); - String paymentTxId = offer.getOfferFeeTxId(); - String txId = transaction.getHash(); - - return txId.equals(paymentTxId); + return txId.equals(openOffer.getReserveTxHash()); } + @Override public Tradable asTradable() { - return delegate; + return openOffer; } } diff --git a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTrade.java b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTrade.java index 1b0151a4..0d398936 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTrade.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTrade.java @@ -18,7 +18,6 @@ package haveno.desktop.main.funds.transactions; import haveno.common.crypto.PubKeyRing; -import haveno.core.offer.Offer; import haveno.core.support.dispute.Dispute; import haveno.core.support.dispute.arbitration.ArbitrationManager; import haveno.core.support.dispute.refund.RefundManager; @@ -29,8 +28,6 @@ import javafx.collections.ObservableList; import lombok.extern.slf4j.Slf4j; import monero.wallet.model.MoneroTxWallet; -import java.util.Optional; - @Slf4j class TransactionAwareTrade implements TransactionAwareTradable { @@ -56,14 +53,12 @@ class TransactionAwareTrade implements TransactionAwareTradable { public boolean isRelatedToTransaction(MoneroTxWallet transaction) { String txId = transaction.getHash(); - boolean isOfferFeeTx = isOfferFeeTx(txId); boolean isMakerDepositTx = isMakerDepositTx(txId); boolean isTakerDepositTx = isTakerDepositTx(txId); boolean isPayoutTx = isPayoutTx(txId); boolean isDisputedPayoutTx = isDisputedPayoutTx(txId); - return isOfferFeeTx || isMakerDepositTx || isTakerDepositTx || - isPayoutTx || isDisputedPayoutTx; + return isMakerDepositTx || isTakerDepositTx || isPayoutTx || isDisputedPayoutTx; } private boolean isPayoutTx(String txId) { @@ -75,14 +70,7 @@ class TransactionAwareTrade implements TransactionAwareTradable { } private boolean isTakerDepositTx(String txId) { - return txId.equals(trade.getTaker().getDepositTxHash()); - } - - private boolean isOfferFeeTx(String txId) { - return Optional.ofNullable(trade.getOffer()) - .map(Offer::getOfferFeeTxId) - .map(paymentTxId -> paymentTxId.equals(txId)) - .orElse(false); + return txId.equals(trade.getTaker().getDepositTxHash()); } private boolean isDisputedPayoutTx(String txId) { diff --git a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionsListItem.java b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionsListItem.java index 39cf6b99..8bf772ba 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionsListItem.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionsListItem.java @@ -119,10 +119,7 @@ class TransactionsListItem { Trade trade = (Trade) tradable; Offer offer = trade.getOffer(); - String offerFeeTxId = offer.getOfferFeeTxId(); - if (offerFeeTxId != null && offerFeeTxId.equals(txId)) { - details = Res.get("funds.tx.createOfferFee", tradeId); - } else if (trade.getSelf().getDepositTxHash() != null && + if (trade.getSelf().getDepositTxHash() != null && trade.getSelf().getDepositTxHash().equals(txId)) { details = Res.get("funds.tx.multiSigDeposit", tradeId); } else if (trade.getPayoutTxId() != null && diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferDataModel.java index 9d312dd9..6e157452 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/editoffer/EditOfferDataModel.java @@ -192,7 +192,6 @@ class EditOfferDataModel extends MutableOfferDataModel { newOfferPayload.getCounterCurrencyCode(), newOfferPayload.getPaymentMethodId(), newOfferPayload.getMakerPaymentAccountId(), - offerPayload.getOfferFeeTxId(), newOfferPayload.getCountryCode(), newOfferPayload.getAcceptedCountryCodes(), newOfferPayload.getBankId(), diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java b/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java index 4048fdff..908b9245 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/failedtrades/FailedTradesView.java @@ -315,9 +315,6 @@ public class FailedTradesView extends ActivatableViewAndModel id = newProperty(); public static final Property paymentMethodId = newProperty(); public static final Property paymentAccountId = newProperty(); - public static final Property offerFeeTxId = newProperty(); public static final Property countryCode = newProperty(); public static final Property> countryCodes = newProperty(); public static final Property date = newProperty(); @@ -85,7 +84,6 @@ public class OfferMaker { lookup.valueOf(counterCurrencyCode, "USD"), lookup.valueOf(paymentMethodId, "SEPA"), lookup.valueOf(paymentAccountId, "00002c4d-1ffc-4208-8ff3-e669817b0000"), - lookup.valueOf(offerFeeTxId, "0000dcd1d388b95714c96ce13f5cb000090c41a1faf89e4ce7680938cc170000"), lookup.valueOf(countryCode, "FR"), lookup.valueOf(countryCodes, new ArrayList<>() {{ add("FR"); diff --git a/proto/src/main/proto/grpc.proto b/proto/src/main/proto/grpc.proto index dd308db6..7a21d02c 100644 --- a/proto/src/main/proto/grpc.proto +++ b/proto/src/main/proto/grpc.proto @@ -533,15 +533,14 @@ message OfferInfo { uint64 date = 17; string state = 18; uint64 seller_security_deposit = 19 [jstype = JS_STRING]; - string offer_fee_tx_id = 20; - uint64 maker_fee = 22 [jstype = JS_STRING]; - bool is_activated = 23; - bool is_my_offer = 24; - string owner_node_address = 25; - string pub_key_ring = 26; - string version_nr = 27; - int32 protocol_version = 28; - string arbitrator_signer = 29; + uint64 maker_fee = 20 [jstype = JS_STRING]; + bool is_activated = 21; + bool is_my_offer = 22; + string owner_node_address = 23; + string pub_key_ring = 24; + string version_nr = 25; + int32 protocol_version = 26; + string arbitrator_signer = 27; } message AvailabilityResultWithDescription { diff --git a/proto/src/main/proto/pb.proto b/proto/src/main/proto/pb.proto index c7994aad..35786184 100644 --- a/proto/src/main/proto/pb.proto +++ b/proto/src/main/proto/pb.proto @@ -614,26 +614,25 @@ message OfferPayload { string counter_currency_code = 12; string payment_method_id = 13; string maker_payment_account_id = 14; - string offer_fee_tx_id = 15; - string country_code = 16; - repeated string accepted_country_codes = 17; - string bank_id = 18; - repeated string accepted_bank_ids = 19; - string version_nr = 20; - int64 block_height_at_offer_creation = 21; - 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; + string country_code = 15; + repeated string accepted_country_codes = 16; + string bank_id = 17; + repeated string accepted_bank_ids = 18; + string version_nr = 19; + int64 block_height_at_offer_creation = 20; + int64 maker_fee = 21; + int64 buyer_security_deposit = 22; + int64 seller_security_deposit = 23; + int64 max_trade_limit = 24; + int64 max_trade_period = 25; + bool use_auto_close = 26; + bool use_re_open_after_auto_close = 27; + int64 lower_close_price = 28; + int64 upper_close_price = 29; + bool is_private_offer = 30; + string hash_of_challenge = 31; + map extra_data = 32; + int32 protocol_version = 33; NodeAddress arbitrator_signer = 1001; bytes arbitrator_signature = 1002; @@ -1528,23 +1527,22 @@ message ProcessModel { string offer_id = 1; string account_id = 2; PubKeyRing pub_key_ring = 3; - string take_offer_fee_tx_id = 4; - bytes payout_tx_signature = 5; - bool use_savings_wallet = 6; - int64 funds_needed_for_trade = 7; - string payment_sent_message_state = 8; - bytes maker_signature = 10; - TradePeer maker = 11; - TradePeer taker = 12; - TradePeer arbitrator = 13; - NodeAddress temp_trade_peer_node_address = 14; - string multisig_address = 15; - PaymentSentMessage payment_sent_message = 16; - PaymentReceivedMessage payment_received_message = 17; - DisputeClosedMessage dispute_closed_message = 18; - bytes mediated_payout_tx_signature = 19; // placeholder if mediation used in future - int64 buyer_payout_amount_from_mediation = 20; - int64 seller_payout_amount_from_mediation = 21; + bytes payout_tx_signature = 4; + bool use_savings_wallet = 5; + int64 funds_needed_for_trade = 6; + string payment_sent_message_state = 7; + bytes maker_signature = 8; + TradePeer maker = 9; + TradePeer taker = 10; + TradePeer arbitrator = 11; + NodeAddress temp_trade_peer_node_address = 12; + string multisig_address = 13; + PaymentSentMessage payment_sent_message = 14; + PaymentReceivedMessage payment_received_message = 15; + DisputeClosedMessage dispute_closed_message = 16; + bytes mediated_payout_tx_signature = 17; // placeholder if mediation used in future + int64 buyer_payout_amount_from_mediation = 18; + int64 seller_payout_amount_from_mediation = 19; } message TradePeer {