mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-23 22:39:33 -05:00
remove offerFeeTxId from models
This commit is contained in:
parent
9fb5dfb788
commit
9c5d0702ba
@ -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())
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -193,7 +193,6 @@ public class CreateOfferService {
|
||||
counterCurrencyCode,
|
||||
paymentAccount.getPaymentMethod().getId(),
|
||||
paymentAccount.getId(),
|
||||
null,
|
||||
countryCode,
|
||||
acceptedCountryCodes,
|
||||
bankId,
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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<String> 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()));
|
||||
|
@ -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<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);
|
||||
}
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -54,7 +54,6 @@ public class OfferMaker {
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"",
|
||||
0L,
|
||||
0L,
|
||||
|
@ -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<GridPane, Void> {
|
||||
addGroup("SellerAsTakerProtocol",
|
||||
FXCollections.observableArrayList(Arrays.asList(
|
||||
ApplyFilter.class,
|
||||
TakerVerifyMakerFeePayment.class,
|
||||
|
||||
ApplyFilter.class,
|
||||
VerifyPeersAccountAgeWitness.class,
|
||||
@ -96,10 +94,8 @@ public class DebugView extends InitializableView<GridPane, Void> {
|
||||
|
||||
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<GridPane, Void> {
|
||||
addGroup("BuyerAsTakerProtocol",
|
||||
FXCollections.observableArrayList(Arrays.asList(
|
||||
ApplyFilter.class,
|
||||
TakerVerifyMakerFeePayment.class,
|
||||
|
||||
ApplyFilter.class,
|
||||
VerifyPeersAccountAgeWitness.class,
|
||||
|
||||
ApplyFilter.class,
|
||||
TakerVerifyMakerFeePayment.class,
|
||||
BuyerPreparePaymentSentMessage.class,
|
||||
BuyerSendPaymentSentMessage.class,
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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 &&
|
||||
|
@ -192,7 +192,6 @@ class EditOfferDataModel extends MutableOfferDataModel {
|
||||
newOfferPayload.getCounterCurrencyCode(),
|
||||
newOfferPayload.getPaymentMethodId(),
|
||||
newOfferPayload.getMakerPaymentAccountId(),
|
||||
offerPayload.getOfferFeeTxId(),
|
||||
newOfferPayload.getCountryCode(),
|
||||
newOfferPayload.getAcceptedCountryCodes(),
|
||||
newOfferPayload.getBankId(),
|
||||
|
@ -315,9 +315,6 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
|
||||
if (model.getDirectionLabel(item).contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
if (offer.getOfferFeeTxId() != null && offer.getOfferFeeTxId().contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Trade trade = item.getTrade();
|
||||
|
||||
|
@ -352,9 +352,6 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
|
||||
if (model.getDirectionLabel(item).contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
if (offer.getOfferFeeTxId() != null && offer.getOfferFeeTxId().contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class FilteringUtils {
|
||||
if (StringUtils.containsIgnoreCase(offer.getPaymentMethod().getDisplayString(), filterString)) {
|
||||
return true;
|
||||
}
|
||||
return offer.getOfferFeeTxId() != null && StringUtils.containsIgnoreCase(offer.getOfferFeeTxId(), filterString);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean match(Trade trade, String filterString) {
|
||||
|
@ -75,12 +75,6 @@ public class TransactionAwareTradeTest {
|
||||
assertTrue(trade.isRelatedToTransaction(transaction));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsRelatedToTransactionWhenOfferFeeTx() {
|
||||
when(delegate.getOffer().getOfferFeeTxId()).thenReturn(XID.toString());
|
||||
assertTrue(trade.isRelatedToTransaction(transaction));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsRelatedToTransactionWhenDisputedPayoutTx() {
|
||||
final String tradeId = "7";
|
||||
|
@ -76,7 +76,6 @@ public class TradesChartsViewModelTest {
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
|
@ -609,7 +609,6 @@ public class OfferBookViewModelTest {
|
||||
tradeCurrencyCode,
|
||||
paymentMethodId,
|
||||
null,
|
||||
null,
|
||||
countryCode,
|
||||
acceptedCountryCodes,
|
||||
bankId,
|
||||
|
@ -44,7 +44,6 @@ public class OfferMaker {
|
||||
public static final Property<Offer, String> id = newProperty();
|
||||
public static final Property<Offer, String> paymentMethodId = 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, List<String>> countryCodes = newProperty();
|
||||
public static final Property<Offer, Long> 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");
|
||||
|
@ -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 {
|
||||
|
@ -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<string, string> 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<string, string> 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user