remove offerFeeTxId from models

This commit is contained in:
woodser 2023-08-16 07:37:59 -04:00
parent 9fb5dfb788
commit 9c5d0702ba
26 changed files with 53 additions and 290 deletions

View File

@ -18,7 +18,6 @@
package haveno.core.api.model; package haveno.core.api.model;
import haveno.common.Payload; import haveno.common.Payload;
import haveno.common.proto.ProtoUtil;
import haveno.core.api.model.builder.OfferInfoBuilder; import haveno.core.api.model.builder.OfferInfoBuilder;
import haveno.core.monetary.Price; import haveno.core.monetary.Price;
import haveno.core.offer.Offer; import haveno.core.offer.Offer;
@ -55,7 +54,6 @@ public class OfferInfo implements Payload {
private final String minVolume; private final String minVolume;
private final long makerFee; private final long makerFee;
@Nullable @Nullable
private final String offerFeeTxId;
private final long buyerSecurityDeposit; private final long buyerSecurityDeposit;
private final long sellerSecurityDeposit; private final long sellerSecurityDeposit;
private final String triggerPrice; private final String triggerPrice;
@ -88,7 +86,6 @@ public class OfferInfo implements Payload {
this.volume = builder.getVolume(); this.volume = builder.getVolume();
this.minVolume = builder.getMinVolume(); this.minVolume = builder.getMinVolume();
this.makerFee = builder.getMakerFee(); this.makerFee = builder.getMakerFee();
this.offerFeeTxId = builder.getOfferFeeTxId();
this.buyerSecurityDeposit = builder.getBuyerSecurityDeposit(); this.buyerSecurityDeposit = builder.getBuyerSecurityDeposit();
this.sellerSecurityDeposit = builder.getSellerSecurityDeposit(); this.sellerSecurityDeposit = builder.getSellerSecurityDeposit();
this.triggerPrice = builder.getTriggerPrice(); this.triggerPrice = builder.getTriggerPrice();
@ -154,7 +151,6 @@ public class OfferInfo implements Payload {
.withVolume(roundedVolume) .withVolume(roundedVolume)
.withMinVolume(roundedMinVolume) .withMinVolume(roundedMinVolume)
.withMakerFee(offer.getMakerFee().longValueExact()) .withMakerFee(offer.getMakerFee().longValueExact())
.withOfferFeeTxId(offer.getOfferFeeTxId())
.withBuyerSecurityDeposit(offer.getBuyerSecurityDeposit().longValueExact()) .withBuyerSecurityDeposit(offer.getBuyerSecurityDeposit().longValueExact())
.withSellerSecurityDeposit(offer.getSellerSecurityDeposit().longValueExact()) .withSellerSecurityDeposit(offer.getSellerSecurityDeposit().longValueExact())
.withPaymentAccountId(offer.getMakerPaymentAccountId()) .withPaymentAccountId(offer.getMakerPaymentAccountId())
@ -205,7 +201,6 @@ public class OfferInfo implements Payload {
.setVersionNr(versionNumber) .setVersionNr(versionNumber)
.setProtocolVersion(protocolVersion); .setProtocolVersion(protocolVersion);
Optional.ofNullable(arbitratorSigner).ifPresent(builder::setArbitratorSigner); Optional.ofNullable(arbitratorSigner).ifPresent(builder::setArbitratorSigner);
Optional.ofNullable(offerFeeTxId).ifPresent(builder::setOfferFeeTxId);
return builder.build(); return builder.build();
} }
@ -222,7 +217,6 @@ public class OfferInfo implements Payload {
.withVolume(proto.getVolume()) .withVolume(proto.getVolume())
.withMinVolume(proto.getMinVolume()) .withMinVolume(proto.getMinVolume())
.withMakerFee(proto.getMakerFee()) .withMakerFee(proto.getMakerFee())
.withOfferFeeTxId(ProtoUtil.stringOrNullFromProto(proto.getOfferFeeTxId()))
.withBuyerSecurityDeposit(proto.getBuyerSecurityDeposit()) .withBuyerSecurityDeposit(proto.getBuyerSecurityDeposit())
.withSellerSecurityDeposit(proto.getSellerSecurityDeposit()) .withSellerSecurityDeposit(proto.getSellerSecurityDeposit())
.withTriggerPrice(proto.getTriggerPrice()) .withTriggerPrice(proto.getTriggerPrice())

View File

@ -39,7 +39,6 @@ public final class OfferInfoBuilder {
private String volume; private String volume;
private String minVolume; private String minVolume;
private long makerFee; private long makerFee;
private String offerFeeTxId;
private long buyerSecurityDeposit; private long buyerSecurityDeposit;
private long sellerSecurityDeposit; private long sellerSecurityDeposit;
private String triggerPrice; private String triggerPrice;
@ -111,11 +110,6 @@ public final class OfferInfoBuilder {
return this; return this;
} }
public OfferInfoBuilder withOfferFeeTxId(String offerFeeTxId) {
this.offerFeeTxId = offerFeeTxId;
return this;
}
public OfferInfoBuilder withBuyerSecurityDeposit(long buyerSecurityDeposit) { public OfferInfoBuilder withBuyerSecurityDeposit(long buyerSecurityDeposit) {
this.buyerSecurityDeposit = buyerSecurityDeposit; this.buyerSecurityDeposit = buyerSecurityDeposit;
return this; return this;

View File

@ -423,7 +423,6 @@ public class HavenoSetup {
() -> { () -> {
if (allBasicServicesInitialized) { if (allBasicServicesInitialized) {
checkForLockedUpFunds(); checkForLockedUpFunds();
checkForInvalidMakerFeeTxs();
} }
}, },
() -> {}); () -> {});
@ -440,7 +439,6 @@ public class HavenoSetup {
if (walletsSetup.downloadPercentageProperty().get() == 1) { // TODO: update for XMR if (walletsSetup.downloadPercentageProperty().get() == 1) { // TODO: update for XMR
checkForLockedUpFunds(); checkForLockedUpFunds();
checkForInvalidMakerFeeTxs();
} }
alertManager.alertMessageProperty().addListener((observable, oldValue, newValue) -> 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 @Nullable
public static String getLastHavenoVersion() { public static String getLastHavenoVersion() {
File versionFile = getVersionFile(); File versionFile = getVersionFile();

View File

@ -206,21 +206,6 @@ public class WalletAppSetup {
log.warn("We handle that reject message as it is likely critical."); log.warn("We handle that reject message as it is likely critical.");
UserThread.runAfter(() -> { UserThread.runAfter(() -> {
String txId = newValue.getTxId(); 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() tradeManager.getObservableList().stream()
.filter(trade -> trade.getOffer() != null) .filter(trade -> trade.getOffer() != null)
@ -231,11 +216,7 @@ public class WalletAppSetup {
} }
if (txId.equals(trade.getTaker().getDepositTxHash())) { if (txId.equals(trade.getTaker().getDepositTxHash())) {
details = Res.get("popup.warning.trade.txRejected.deposit"); 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) { if (details != null) {
// We delay to avoid concurrent modification exceptions // We delay to avoid concurrent modification exceptions
String finalDetails = details; String finalDetails = details;

View File

@ -193,7 +193,6 @@ public class CreateOfferService {
counterCurrencyCode, counterCurrencyCode,
paymentAccount.getPaymentMethod().getId(), paymentAccount.getPaymentMethod().getId(),
paymentAccount.getId(), paymentAccount.getId(),
null,
countryCode, countryCode,
acceptedCountryCodes, acceptedCountryCodes,
bankId, bankId,

View File

@ -268,10 +268,6 @@ public class Offer implements NetworkPayload, PersistablePayload {
return stateProperty; return stateProperty;
} }
public void setOfferFeeTxId(String offerFeeTxId) {
offerPayload.setOfferFeeTxId(offerFeeTxId);
}
public void setErrorMessage(String errorMessage) { public void setErrorMessage(String errorMessage) {
this.errorMessageProperty.set(errorMessage); this.errorMessageProperty.set(errorMessage);
} }
@ -477,10 +473,6 @@ public class Offer implements NetworkPayload, PersistablePayload {
return offerPayload.getMakerPaymentAccountId(); return offerPayload.getMakerPaymentAccountId();
} }
public String getOfferFeeTxId() {
return offerPayload.getOfferFeeTxId();
}
public String getVersionNr() { public String getVersionNr() {
return offerPayload.getVersionNr(); return offerPayload.getVersionNr();
} }

View File

@ -120,9 +120,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
private final boolean useMarketBasedPrice; private final boolean useMarketBasedPrice;
// Mutable property. Has to be set before offer is saved in P2P network as it changes the payload hash! // 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 @Nullable
private final String countryCode; private final String countryCode;
@Nullable @Nullable
@ -172,7 +169,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
String counterCurrencyCode, String counterCurrencyCode,
String paymentMethodId, String paymentMethodId,
String makerPaymentAccountId, String makerPaymentAccountId,
@Nullable String offerFeeTxId,
@Nullable String countryCode, @Nullable String countryCode,
@Nullable List<String> acceptedCountryCodes, @Nullable List<String> acceptedCountryCodes,
@Nullable String bankId, @Nullable String bankId,
@ -215,7 +211,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
this.reserveTxKeyImages = reserveTxKeyImages; this.reserveTxKeyImages = reserveTxKeyImages;
this.marketPriceMarginPct = marketPriceMarginPct; this.marketPriceMarginPct = marketPriceMarginPct;
this.useMarketBasedPrice = useMarketBasedPrice; this.useMarketBasedPrice = useMarketBasedPrice;
this.offerFeeTxId = offerFeeTxId;
this.countryCode = countryCode; this.countryCode = countryCode;
this.acceptedCountryCodes = acceptedCountryCodes; this.acceptedCountryCodes = acceptedCountryCodes;
this.bankId = bankId; this.bankId = bankId;
@ -236,8 +231,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
public byte[] getHash() { public byte[] getHash() {
if (this.hash == null) { 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()); this.hash = Hash.getSha256Hash(this.toProtoMessage().toByteArray());
} }
return this.hash; return this.hash;
@ -261,7 +254,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
counterCurrencyCode, counterCurrencyCode,
paymentMethodId, paymentMethodId,
makerPaymentAccountId, makerPaymentAccountId,
offerFeeTxId,
countryCode, countryCode,
acceptedCountryCodes, acceptedCountryCodes,
bankId, bankId,
@ -342,7 +334,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
.setIsPrivateOffer(isPrivateOffer) .setIsPrivateOffer(isPrivateOffer)
.setProtocolVersion(protocolVersion); .setProtocolVersion(protocolVersion);
Optional.ofNullable(ownerNodeAddress).ifPresent(e -> builder.setOwnerNodeAddress(ownerNodeAddress.toProtoMessage())); Optional.ofNullable(ownerNodeAddress).ifPresent(e -> builder.setOwnerNodeAddress(ownerNodeAddress.toProtoMessage()));
Optional.ofNullable(offerFeeTxId).ifPresent(builder::setOfferFeeTxId);
Optional.ofNullable(countryCode).ifPresent(builder::setCountryCode); Optional.ofNullable(countryCode).ifPresent(builder::setCountryCode);
Optional.ofNullable(bankId).ifPresent(builder::setBankId); Optional.ofNullable(bankId).ifPresent(builder::setBankId);
Optional.ofNullable(acceptedBankIds).ifPresent(builder::addAllAcceptedBankIds); Optional.ofNullable(acceptedBankIds).ifPresent(builder::addAllAcceptedBankIds);
@ -379,7 +370,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
proto.getCounterCurrencyCode(), proto.getCounterCurrencyCode(),
proto.getPaymentMethodId(), proto.getPaymentMethodId(),
proto.getMakerPaymentAccountId(), proto.getMakerPaymentAccountId(),
ProtoUtil.stringOrNullFromProto(proto.getOfferFeeTxId()),
ProtoUtil.stringOrNullFromProto(proto.getCountryCode()), ProtoUtil.stringOrNullFromProto(proto.getCountryCode()),
acceptedCountryCodes, acceptedCountryCodes,
ProtoUtil.stringOrNullFromProto(proto.getBankId()), ProtoUtil.stringOrNullFromProto(proto.getBankId()),
@ -426,7 +416,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
",\r\n reserveTxKeyImages=" + reserveTxKeyImages + ",\r\n reserveTxKeyImages=" + reserveTxKeyImages +
",\r\n marketPriceMargin=" + marketPriceMarginPct + ",\r\n marketPriceMargin=" + marketPriceMarginPct +
",\r\n useMarketBasedPrice=" + useMarketBasedPrice + ",\r\n useMarketBasedPrice=" + useMarketBasedPrice +
",\r\n offerFeeTxId='" + offerFeeTxId + '\'' +
",\r\n countryCode='" + countryCode + '\'' + ",\r\n countryCode='" + countryCode + '\'' +
",\r\n acceptedCountryCodes=" + acceptedCountryCodes + ",\r\n acceptedCountryCodes=" + acceptedCountryCodes +
",\r\n bankId='" + bankId + '\'' + ",\r\n bankId='" + bankId + '\'' +
@ -468,7 +457,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
object.add("counterCurrencyCode", context.serialize(offerPayload.getCounterCurrencyCode())); object.add("counterCurrencyCode", context.serialize(offerPayload.getCounterCurrencyCode()));
object.add("paymentMethodId", context.serialize(offerPayload.getPaymentMethodId())); object.add("paymentMethodId", context.serialize(offerPayload.getPaymentMethodId()));
object.add("makerPaymentAccountId", context.serialize(offerPayload.getMakerPaymentAccountId())); object.add("makerPaymentAccountId", context.serialize(offerPayload.getMakerPaymentAccountId()));
object.add("offerFeeTxId", context.serialize(offerPayload.getOfferFeeTxId()));
object.add("versionNr", context.serialize(offerPayload.getVersionNr())); object.add("versionNr", context.serialize(offerPayload.getVersionNr()));
object.add("blockHeightAtOfferCreation", context.serialize(offerPayload.getBlockHeightAtOfferCreation())); object.add("blockHeightAtOfferCreation", context.serialize(offerPayload.getBlockHeightAtOfferCreation()));
object.add("makerFee", context.serialize(offerPayload.getMakerFee())); object.add("makerFee", context.serialize(offerPayload.getMakerFee()));

View File

@ -37,12 +37,8 @@ import haveno.core.trade.statistics.ReferralIdService;
import haveno.core.user.AutoConfirmSettings; import haveno.core.user.AutoConfirmSettings;
import haveno.core.user.Preferences; import haveno.core.user.Preferences;
import haveno.core.util.coin.CoinFormatter; import haveno.core.util.coin.CoinFormatter;
import haveno.core.xmr.wallet.BtcWalletService;
import haveno.network.p2p.P2PService; import haveno.network.p2p.P2PService;
import lombok.extern.slf4j.Slf4j; 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.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@ -251,58 +247,4 @@ public class OfferUtil {
public static boolean isCryptoOffer(Offer offer) { public static boolean isCryptoOffer(Offer offer) {
return offer.getCounterCurrencyCode().equals("XMR"); return offer.getCounterCurrencyCode().equals("XMR");
} }
public static Optional<String> 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);
}
} }

View File

@ -1494,7 +1494,6 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
originalOfferPayload.getCounterCurrencyCode(), originalOfferPayload.getCounterCurrencyCode(),
originalOfferPayload.getPaymentMethodId(), originalOfferPayload.getPaymentMethodId(),
originalOfferPayload.getMakerPaymentAccountId(), originalOfferPayload.getMakerPaymentAccountId(),
originalOfferPayload.getOfferFeeTxId(),
originalOfferPayload.getCountryCode(), originalOfferPayload.getCountryCode(),
originalOfferPayload.getAcceptedCountryCodes(), originalOfferPayload.getAcceptedCountryCodes(),
originalOfferPayload.getBankId(), originalOfferPayload.getBankId(),

View File

@ -98,9 +98,6 @@ public class ProcessModel implements Model, PersistablePayload {
// Persistable Mutable // Persistable Mutable
@Nullable @Nullable
@Setter @Setter
private String takeOfferFeeTxId;
@Nullable
@Setter
private byte[] payoutTxSignature; private byte[] payoutTxSignature;
@Nullable @Nullable
@Setter @Setter
@ -207,7 +204,6 @@ public class ProcessModel implements Model, PersistablePayload {
Optional.ofNullable(maker).ifPresent(e -> builder.setMaker((protobuf.TradePeer) maker.toProtoMessage())); Optional.ofNullable(maker).ifPresent(e -> builder.setMaker((protobuf.TradePeer) maker.toProtoMessage()));
Optional.ofNullable(taker).ifPresent(e -> builder.setTaker((protobuf.TradePeer) taker.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(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(payoutTxSignature).ifPresent(e -> builder.setPayoutTxSignature(ByteString.copyFrom(payoutTxSignature)));
Optional.ofNullable(tempTradePeerNodeAddress).ifPresent(e -> builder.setTempTradePeerNodeAddress(tempTradePeerNodeAddress.toProtoMessage())); Optional.ofNullable(tempTradePeerNodeAddress).ifPresent(e -> builder.setTempTradePeerNodeAddress(tempTradePeerNodeAddress.toProtoMessage()));
Optional.ofNullable(mediatedPayoutTxSignature).ifPresent(e -> builder.setMediatedPayoutTxSignature(ByteString.copyFrom(e))); Optional.ofNullable(mediatedPayoutTxSignature).ifPresent(e -> builder.setMediatedPayoutTxSignature(ByteString.copyFrom(e)));
@ -231,7 +227,6 @@ public class ProcessModel implements Model, PersistablePayload {
processModel.setSellerPayoutAmountFromMediation(proto.getSellerPayoutAmountFromMediation()); processModel.setSellerPayoutAmountFromMediation(proto.getSellerPayoutAmountFromMediation());
// nullable // nullable
processModel.setTakeOfferFeeTxId(ProtoUtil.stringOrNullFromProto(proto.getTakeOfferFeeTxId()));
processModel.setPayoutTxSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getPayoutTxSignature())); processModel.setPayoutTxSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getPayoutTxSignature()));
processModel.setTempTradePeerNodeAddress(proto.hasTempTradePeerNodeAddress() ? NodeAddress.fromProto(proto.getTempTradePeerNodeAddress()) : null); processModel.setTempTradePeerNodeAddress(proto.hasTempTradePeerNodeAddress() ? NodeAddress.fromProto(proto.getTempTradePeerNodeAddress()) : null);
processModel.setMediatedPayoutTxSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getMediatedPayoutTxSignature())); processModel.setMediatedPayoutTxSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getMediatedPayoutTxSignature()));
@ -257,11 +252,6 @@ public class ProcessModel implements Model, PersistablePayload {
public void onComplete() { public void onComplete() {
} }
public void setTakeOfferFeeTx(MoneroTxWallet takeOfferFeeTx) {
this.takeOfferFeeTx = takeOfferFeeTx;
takeOfferFeeTxId = takeOfferFeeTx.getHash();
}
@Nullable @Nullable
public PaymentAccountPayload getPaymentAccountPayload(String paymentAccountId) { public PaymentAccountPayload getPaymentAccountPayload(String paymentAccountId) {
PaymentAccount paymentAccount = getUser().getPaymentAccount(paymentAccountId); PaymentAccount paymentAccount = getUser().getPaymentAccount(paymentAccountId);
@ -272,13 +262,6 @@ public class ProcessModel implements Model, PersistablePayload {
return Coin.valueOf(fundsNeededForTrade); return Coin.valueOf(fundsNeededForTrade);
} }
public MoneroTxWallet resolveTakeOfferFeeTx(Trade trade) {
if (takeOfferFeeTx == null) {
takeOfferFeeTx = provider.getXmrWalletService().getWallet().getTx(takeOfferFeeTxId);
}
return takeOfferFeeTx;
}
public NodeAddress getMyNodeAddress() { public NodeAddress getMyNodeAddress() {
return getP2PService().getAddress(); return getP2PService().getAddress();
} }

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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<Trade> 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);
}
}
}

View File

@ -54,7 +54,6 @@ public class OfferMaker {
null, null,
null, null,
null, null,
null,
"", "",
0L, 0L,
0L, 0L,

View File

@ -35,7 +35,6 @@ import haveno.core.trade.protocol.tasks.SellerPreparePaymentReceivedMessage;
import haveno.core.trade.protocol.tasks.SellerPublishDepositTx; import haveno.core.trade.protocol.tasks.SellerPublishDepositTx;
import haveno.core.trade.protocol.tasks.SellerPublishTradeStatistics; import haveno.core.trade.protocol.tasks.SellerPublishTradeStatistics;
import haveno.core.trade.protocol.tasks.SellerSendPaymentReceivedMessageToBuyer; import haveno.core.trade.protocol.tasks.SellerSendPaymentReceivedMessageToBuyer;
import haveno.core.trade.protocol.tasks.TakerVerifyMakerFeePayment;
import haveno.core.trade.protocol.tasks.VerifyPeersAccountAgeWitness; import haveno.core.trade.protocol.tasks.VerifyPeersAccountAgeWitness;
import haveno.desktop.common.view.FxmlView; import haveno.desktop.common.view.FxmlView;
import haveno.desktop.common.view.InitializableView; import haveno.desktop.common.view.InitializableView;
@ -85,7 +84,6 @@ public class DebugView extends InitializableView<GridPane, Void> {
addGroup("SellerAsTakerProtocol", addGroup("SellerAsTakerProtocol",
FXCollections.observableArrayList(Arrays.asList( FXCollections.observableArrayList(Arrays.asList(
ApplyFilter.class, ApplyFilter.class,
TakerVerifyMakerFeePayment.class,
ApplyFilter.class, ApplyFilter.class,
VerifyPeersAccountAgeWitness.class, VerifyPeersAccountAgeWitness.class,
@ -96,10 +94,8 @@ public class DebugView extends InitializableView<GridPane, Void> {
ProcessPaymentSentMessage.class, ProcessPaymentSentMessage.class,
ApplyFilter.class, ApplyFilter.class,
TakerVerifyMakerFeePayment.class,
ApplyFilter.class, ApplyFilter.class,
TakerVerifyMakerFeePayment.class,
SellerPreparePaymentReceivedMessage.class, SellerPreparePaymentReceivedMessage.class,
//SellerBroadcastPayoutTx.class, // TODO (woodser): removed from main pipeline; debug view? //SellerBroadcastPayoutTx.class, // TODO (woodser): removed from main pipeline; debug view?
SellerSendPaymentReceivedMessageToBuyer.class SellerSendPaymentReceivedMessageToBuyer.class
@ -126,13 +122,11 @@ public class DebugView extends InitializableView<GridPane, Void> {
addGroup("BuyerAsTakerProtocol", addGroup("BuyerAsTakerProtocol",
FXCollections.observableArrayList(Arrays.asList( FXCollections.observableArrayList(Arrays.asList(
ApplyFilter.class, ApplyFilter.class,
TakerVerifyMakerFeePayment.class,
ApplyFilter.class, ApplyFilter.class,
VerifyPeersAccountAgeWitness.class, VerifyPeersAccountAgeWitness.class,
ApplyFilter.class, ApplyFilter.class,
TakerVerifyMakerFeePayment.class,
BuyerPreparePaymentSentMessage.class, BuyerPreparePaymentSentMessage.class,
BuyerSendPaymentSentMessage.class, BuyerSendPaymentSentMessage.class,

View File

@ -17,28 +17,25 @@
package haveno.desktop.main.funds.transactions; package haveno.desktop.main.funds.transactions;
import haveno.core.offer.Offer;
import haveno.core.offer.OpenOffer; import haveno.core.offer.OpenOffer;
import haveno.core.trade.Tradable; import haveno.core.trade.Tradable;
import monero.wallet.model.MoneroTxWallet; import monero.wallet.model.MoneroTxWallet;
class TransactionAwareOpenOffer implements TransactionAwareTradable { class TransactionAwareOpenOffer implements TransactionAwareTradable {
private final OpenOffer delegate; private final OpenOffer openOffer;
TransactionAwareOpenOffer(OpenOffer delegate) { TransactionAwareOpenOffer(OpenOffer delegate) {
this.delegate = delegate; this.openOffer = delegate;
} }
@Override
public boolean isRelatedToTransaction(MoneroTxWallet transaction) { public boolean isRelatedToTransaction(MoneroTxWallet transaction) {
Offer offer = delegate.getOffer();
String paymentTxId = offer.getOfferFeeTxId();
String txId = transaction.getHash(); String txId = transaction.getHash();
return txId.equals(openOffer.getReserveTxHash());
return txId.equals(paymentTxId);
} }
@Override
public Tradable asTradable() { public Tradable asTradable() {
return delegate; return openOffer;
} }
} }

View File

@ -18,7 +18,6 @@
package haveno.desktop.main.funds.transactions; package haveno.desktop.main.funds.transactions;
import haveno.common.crypto.PubKeyRing; import haveno.common.crypto.PubKeyRing;
import haveno.core.offer.Offer;
import haveno.core.support.dispute.Dispute; import haveno.core.support.dispute.Dispute;
import haveno.core.support.dispute.arbitration.ArbitrationManager; import haveno.core.support.dispute.arbitration.ArbitrationManager;
import haveno.core.support.dispute.refund.RefundManager; import haveno.core.support.dispute.refund.RefundManager;
@ -29,8 +28,6 @@ import javafx.collections.ObservableList;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import monero.wallet.model.MoneroTxWallet; import monero.wallet.model.MoneroTxWallet;
import java.util.Optional;
@Slf4j @Slf4j
class TransactionAwareTrade implements TransactionAwareTradable { class TransactionAwareTrade implements TransactionAwareTradable {
@ -56,14 +53,12 @@ class TransactionAwareTrade implements TransactionAwareTradable {
public boolean isRelatedToTransaction(MoneroTxWallet transaction) { public boolean isRelatedToTransaction(MoneroTxWallet transaction) {
String txId = transaction.getHash(); String txId = transaction.getHash();
boolean isOfferFeeTx = isOfferFeeTx(txId);
boolean isMakerDepositTx = isMakerDepositTx(txId); boolean isMakerDepositTx = isMakerDepositTx(txId);
boolean isTakerDepositTx = isTakerDepositTx(txId); boolean isTakerDepositTx = isTakerDepositTx(txId);
boolean isPayoutTx = isPayoutTx(txId); boolean isPayoutTx = isPayoutTx(txId);
boolean isDisputedPayoutTx = isDisputedPayoutTx(txId); boolean isDisputedPayoutTx = isDisputedPayoutTx(txId);
return isOfferFeeTx || isMakerDepositTx || isTakerDepositTx || return isMakerDepositTx || isTakerDepositTx || isPayoutTx || isDisputedPayoutTx;
isPayoutTx || isDisputedPayoutTx;
} }
private boolean isPayoutTx(String txId) { private boolean isPayoutTx(String txId) {
@ -75,14 +70,7 @@ class TransactionAwareTrade implements TransactionAwareTradable {
} }
private boolean isTakerDepositTx(String txId) { private boolean isTakerDepositTx(String txId) {
return txId.equals(trade.getTaker().getDepositTxHash()); 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);
} }
private boolean isDisputedPayoutTx(String txId) { private boolean isDisputedPayoutTx(String txId) {

View File

@ -119,10 +119,7 @@ class TransactionsListItem {
Trade trade = (Trade) tradable; Trade trade = (Trade) tradable;
Offer offer = trade.getOffer(); Offer offer = trade.getOffer();
String offerFeeTxId = offer.getOfferFeeTxId(); if (trade.getSelf().getDepositTxHash() != null &&
if (offerFeeTxId != null && offerFeeTxId.equals(txId)) {
details = Res.get("funds.tx.createOfferFee", tradeId);
} else if (trade.getSelf().getDepositTxHash() != null &&
trade.getSelf().getDepositTxHash().equals(txId)) { trade.getSelf().getDepositTxHash().equals(txId)) {
details = Res.get("funds.tx.multiSigDeposit", tradeId); details = Res.get("funds.tx.multiSigDeposit", tradeId);
} else if (trade.getPayoutTxId() != null && } else if (trade.getPayoutTxId() != null &&

View File

@ -192,7 +192,6 @@ class EditOfferDataModel extends MutableOfferDataModel {
newOfferPayload.getCounterCurrencyCode(), newOfferPayload.getCounterCurrencyCode(),
newOfferPayload.getPaymentMethodId(), newOfferPayload.getPaymentMethodId(),
newOfferPayload.getMakerPaymentAccountId(), newOfferPayload.getMakerPaymentAccountId(),
offerPayload.getOfferFeeTxId(),
newOfferPayload.getCountryCode(), newOfferPayload.getCountryCode(),
newOfferPayload.getAcceptedCountryCodes(), newOfferPayload.getAcceptedCountryCodes(),
newOfferPayload.getBankId(), newOfferPayload.getBankId(),

View File

@ -315,9 +315,6 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
if (model.getDirectionLabel(item).contains(filterString)) { if (model.getDirectionLabel(item).contains(filterString)) {
return true; return true;
} }
if (offer.getOfferFeeTxId() != null && offer.getOfferFeeTxId().contains(filterString)) {
return true;
}
Trade trade = item.getTrade(); Trade trade = item.getTrade();

View File

@ -352,9 +352,6 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
if (model.getDirectionLabel(item).contains(filterString)) { if (model.getDirectionLabel(item).contains(filterString)) {
return true; return true;
} }
if (offer.getOfferFeeTxId() != null && offer.getOfferFeeTxId().contains(filterString)) {
return true;
}
return false; return false;
}); });
} }

View File

@ -29,7 +29,7 @@ public class FilteringUtils {
if (StringUtils.containsIgnoreCase(offer.getPaymentMethod().getDisplayString(), filterString)) { if (StringUtils.containsIgnoreCase(offer.getPaymentMethod().getDisplayString(), filterString)) {
return true; return true;
} }
return offer.getOfferFeeTxId() != null && StringUtils.containsIgnoreCase(offer.getOfferFeeTxId(), filterString); return false;
} }
public static boolean match(Trade trade, String filterString) { public static boolean match(Trade trade, String filterString) {

View File

@ -75,12 +75,6 @@ public class TransactionAwareTradeTest {
assertTrue(trade.isRelatedToTransaction(transaction)); assertTrue(trade.isRelatedToTransaction(transaction));
} }
@Test
public void testIsRelatedToTransactionWhenOfferFeeTx() {
when(delegate.getOffer().getOfferFeeTxId()).thenReturn(XID.toString());
assertTrue(trade.isRelatedToTransaction(transaction));
}
@Test @Test
public void testIsRelatedToTransactionWhenDisputedPayoutTx() { public void testIsRelatedToTransactionWhenDisputedPayoutTx() {
final String tradeId = "7"; final String tradeId = "7";

View File

@ -76,7 +76,6 @@ public class TradesChartsViewModelTest {
null, null,
null, null,
null, null,
null,
0, 0,
0, 0,
0, 0,

View File

@ -609,7 +609,6 @@ public class OfferBookViewModelTest {
tradeCurrencyCode, tradeCurrencyCode,
paymentMethodId, paymentMethodId,
null, null,
null,
countryCode, countryCode,
acceptedCountryCodes, acceptedCountryCodes,
bankId, bankId,

View File

@ -44,7 +44,6 @@ public class OfferMaker {
public static final Property<Offer, String> id = newProperty(); public static final Property<Offer, String> id = newProperty();
public static final Property<Offer, String> paymentMethodId = newProperty(); public static final Property<Offer, String> paymentMethodId = newProperty();
public static final Property<Offer, String> paymentAccountId = newProperty(); public static final Property<Offer, String> paymentAccountId = newProperty();
public static final Property<Offer, String> offerFeeTxId = newProperty();
public static final Property<Offer, String> countryCode = newProperty(); public static final Property<Offer, String> countryCode = newProperty();
public static final Property<Offer, List<String>> countryCodes = newProperty(); public static final Property<Offer, List<String>> countryCodes = newProperty();
public static final Property<Offer, Long> date = newProperty(); public static final Property<Offer, Long> date = newProperty();
@ -85,7 +84,6 @@ public class OfferMaker {
lookup.valueOf(counterCurrencyCode, "USD"), lookup.valueOf(counterCurrencyCode, "USD"),
lookup.valueOf(paymentMethodId, "SEPA"), lookup.valueOf(paymentMethodId, "SEPA"),
lookup.valueOf(paymentAccountId, "00002c4d-1ffc-4208-8ff3-e669817b0000"), lookup.valueOf(paymentAccountId, "00002c4d-1ffc-4208-8ff3-e669817b0000"),
lookup.valueOf(offerFeeTxId, "0000dcd1d388b95714c96ce13f5cb000090c41a1faf89e4ce7680938cc170000"),
lookup.valueOf(countryCode, "FR"), lookup.valueOf(countryCode, "FR"),
lookup.valueOf(countryCodes, new ArrayList<>() {{ lookup.valueOf(countryCodes, new ArrayList<>() {{
add("FR"); add("FR");

View File

@ -533,15 +533,14 @@ message OfferInfo {
uint64 date = 17; uint64 date = 17;
string state = 18; string state = 18;
uint64 seller_security_deposit = 19 [jstype = JS_STRING]; uint64 seller_security_deposit = 19 [jstype = JS_STRING];
string offer_fee_tx_id = 20; uint64 maker_fee = 20 [jstype = JS_STRING];
uint64 maker_fee = 22 [jstype = JS_STRING]; bool is_activated = 21;
bool is_activated = 23; bool is_my_offer = 22;
bool is_my_offer = 24; string owner_node_address = 23;
string owner_node_address = 25; string pub_key_ring = 24;
string pub_key_ring = 26; string version_nr = 25;
string version_nr = 27; int32 protocol_version = 26;
int32 protocol_version = 28; string arbitrator_signer = 27;
string arbitrator_signer = 29;
} }
message AvailabilityResultWithDescription { message AvailabilityResultWithDescription {

View File

@ -614,26 +614,25 @@ message OfferPayload {
string counter_currency_code = 12; string counter_currency_code = 12;
string payment_method_id = 13; string payment_method_id = 13;
string maker_payment_account_id = 14; string maker_payment_account_id = 14;
string offer_fee_tx_id = 15; string country_code = 15;
string country_code = 16; repeated string accepted_country_codes = 16;
repeated string accepted_country_codes = 17; string bank_id = 17;
string bank_id = 18; repeated string accepted_bank_ids = 18;
repeated string accepted_bank_ids = 19; string version_nr = 19;
string version_nr = 20; int64 block_height_at_offer_creation = 20;
int64 block_height_at_offer_creation = 21; int64 maker_fee = 21;
int64 maker_fee = 22; int64 buyer_security_deposit = 22;
int64 buyer_security_deposit = 23; int64 seller_security_deposit = 23;
int64 seller_security_deposit = 24; int64 max_trade_limit = 24;
int64 max_trade_limit = 25; int64 max_trade_period = 25;
int64 max_trade_period = 26; bool use_auto_close = 26;
bool use_auto_close = 27; bool use_re_open_after_auto_close = 27;
bool use_re_open_after_auto_close = 28; int64 lower_close_price = 28;
int64 lower_close_price = 29; int64 upper_close_price = 29;
int64 upper_close_price = 30; bool is_private_offer = 30;
bool is_private_offer = 31; string hash_of_challenge = 31;
string hash_of_challenge = 32; map<string, string> extra_data = 32;
map<string, string> extra_data = 33; int32 protocol_version = 33;
int32 protocol_version = 34;
NodeAddress arbitrator_signer = 1001; NodeAddress arbitrator_signer = 1001;
bytes arbitrator_signature = 1002; bytes arbitrator_signature = 1002;
@ -1528,23 +1527,22 @@ message ProcessModel {
string offer_id = 1; string offer_id = 1;
string account_id = 2; string account_id = 2;
PubKeyRing pub_key_ring = 3; PubKeyRing pub_key_ring = 3;
string take_offer_fee_tx_id = 4; bytes payout_tx_signature = 4;
bytes payout_tx_signature = 5; bool use_savings_wallet = 5;
bool use_savings_wallet = 6; int64 funds_needed_for_trade = 6;
int64 funds_needed_for_trade = 7; string payment_sent_message_state = 7;
string payment_sent_message_state = 8; bytes maker_signature = 8;
bytes maker_signature = 10; TradePeer maker = 9;
TradePeer maker = 11; TradePeer taker = 10;
TradePeer taker = 12; TradePeer arbitrator = 11;
TradePeer arbitrator = 13; NodeAddress temp_trade_peer_node_address = 12;
NodeAddress temp_trade_peer_node_address = 14; string multisig_address = 13;
string multisig_address = 15; PaymentSentMessage payment_sent_message = 14;
PaymentSentMessage payment_sent_message = 16; PaymentReceivedMessage payment_received_message = 15;
PaymentReceivedMessage payment_received_message = 17; DisputeClosedMessage dispute_closed_message = 16;
DisputeClosedMessage dispute_closed_message = 18; bytes mediated_payout_tx_signature = 17; // placeholder if mediation used in future
bytes mediated_payout_tx_signature = 19; // placeholder if mediation used in future int64 buyer_payout_amount_from_mediation = 18;
int64 buyer_payout_amount_from_mediation = 20; int64 seller_payout_amount_from_mediation = 19;
int64 seller_payout_amount_from_mediation = 21;
} }
message TradePeer { message TradePeer {