diff --git a/core/src/main/java/haveno/core/api/model/ContractInfo.java b/core/src/main/java/haveno/core/api/model/ContractInfo.java index ceed9947fb..54a74fc63a 100644 --- a/core/src/main/java/haveno/core/api/model/ContractInfo.java +++ b/core/src/main/java/haveno/core/api/model/ContractInfo.java @@ -41,7 +41,6 @@ public class ContractInfo implements Payload { private final PaymentAccountPayload takerPaymentAccountPayload; private final String makerPayoutAddressString; private final String takerPayoutAddressString; - private final long lockTime; public ContractInfo(String buyerNodeAddress, String sellerNodeAddress, @@ -52,8 +51,7 @@ public class ContractInfo implements Payload { PaymentAccountPayload makerPaymentAccountPayload, PaymentAccountPayload takerPaymentAccountPayload, String makerPayoutAddressString, - String takerPayoutAddressString, - long lockTime) { + String takerPayoutAddressString) { this.buyerNodeAddress = buyerNodeAddress; this.sellerNodeAddress = sellerNodeAddress; this.arbitratorNodeAddress = arbitratorNodeAddress; @@ -64,7 +62,6 @@ public class ContractInfo implements Payload { this.takerPaymentAccountPayload = takerPaymentAccountPayload; this.makerPayoutAddressString = makerPayoutAddressString; this.takerPayoutAddressString = takerPayoutAddressString; - this.lockTime = lockTime; } @@ -79,8 +76,7 @@ public class ContractInfo implements Payload { null, null, "", - "", - 0); + ""); /////////////////////////////////////////////////////////////////////////////////////////// // PROTO BUFFER @@ -97,8 +93,7 @@ public class ContractInfo implements Payload { proto.getMakerPaymentAccountPayload() == null ? null : PaymentAccountPayload.fromProto(proto.getMakerPaymentAccountPayload(), coreProtoResolver), proto.getTakerPaymentAccountPayload() == null ? null : PaymentAccountPayload.fromProto(proto.getTakerPaymentAccountPayload(), coreProtoResolver), proto.getMakerPayoutAddressString(), - proto.getTakerPayoutAddressString(), - proto.getLockTime()); + proto.getTakerPayoutAddressString()); } @Override @@ -111,8 +106,7 @@ public class ContractInfo implements Payload { .setMakerAccountId(makerAccountId) .setTakerAccountId(takerAccountId) .setMakerPayoutAddressString(makerPayoutAddressString) - .setTakerPayoutAddressString(takerPayoutAddressString) - .setLockTime(lockTime); + .setTakerPayoutAddressString(takerPayoutAddressString); if (makerPaymentAccountPayload != null) builder.setMakerPaymentAccountPayload((protobuf.PaymentAccountPayload) makerPaymentAccountPayload.toProtoMessage()); if (takerPaymentAccountPayload != null) builder.setTakerPaymentAccountPayload((protobuf.PaymentAccountPayload) takerPaymentAccountPayload.toProtoMessage()); return builder.build(); 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 6a4ef94dba..f91609fd07 100644 --- a/core/src/main/java/haveno/core/api/model/OfferInfo.java +++ b/core/src/main/java/haveno/core/api/model/OfferInfo.java @@ -54,7 +54,7 @@ public class OfferInfo implements Payload { private final String minVolume; private final long makerFee; @Nullable - private final String offerFeePaymentTxId; + private final String offerFeeTxId; private final long buyerSecurityDeposit; private final long sellerSecurityDeposit; private final String triggerPrice; @@ -87,7 +87,7 @@ public class OfferInfo implements Payload { this.volume = builder.getVolume(); this.minVolume = builder.getMinVolume(); this.makerFee = builder.getMakerFee(); - this.offerFeePaymentTxId = builder.getOfferFeePaymentTxId(); + this.offerFeeTxId = builder.getOfferFeeTxId(); this.buyerSecurityDeposit = builder.getBuyerSecurityDeposit(); this.sellerSecurityDeposit = builder.getSellerSecurityDeposit(); this.triggerPrice = builder.getTriggerPrice(); @@ -153,7 +153,7 @@ public class OfferInfo implements Payload { .withVolume(roundedVolume) .withMinVolume(roundedMinVolume) .withMakerFee(offer.getMakerFee().longValueExact()) - .withOfferFeePaymentTxId(offer.getOfferFeePaymentTxId()) + .withOfferFeeTxId(offer.getOfferFeeTxId()) .withBuyerSecurityDeposit(offer.getBuyerSecurityDeposit().longValueExact()) .withSellerSecurityDeposit(offer.getSellerSecurityDeposit().longValueExact()) .withPaymentAccountId(offer.getMakerPaymentAccountId()) @@ -204,7 +204,7 @@ public class OfferInfo implements Payload { .setVersionNr(versionNumber) .setProtocolVersion(protocolVersion); Optional.ofNullable(arbitratorSigner).ifPresent(builder::setArbitratorSigner); - Optional.ofNullable(offerFeePaymentTxId).ifPresent(builder::setOfferFeePaymentTxId); + Optional.ofNullable(offerFeeTxId).ifPresent(builder::setOfferFeeTxId); return builder.build(); } @@ -221,7 +221,7 @@ public class OfferInfo implements Payload { .withVolume(proto.getVolume()) .withMinVolume(proto.getMinVolume()) .withMakerFee(proto.getMakerFee()) - .withOfferFeePaymentTxId(ProtoUtil.stringOrNullFromProto(proto.getOfferFeePaymentTxId())) + .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/TradeInfo.java b/core/src/main/java/haveno/core/api/model/TradeInfo.java index 0916ca80e9..1c51280a75 100644 --- a/core/src/main/java/haveno/core/api/model/TradeInfo.java +++ b/core/src/main/java/haveno/core/api/model/TradeInfo.java @@ -143,8 +143,7 @@ public class TradeInfo implements Payload { trade.getMaker().getPaymentAccountPayload(), trade.getTaker().getPaymentAccountPayload(), contract.getMakerPayoutAddressString(), - contract.getTakerPayoutAddressString(), - contract.getLockTime()); + contract.getTakerPayoutAddressString()); } else { contractInfo = ContractInfo.emptyContract.get(); } 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 c726551a3d..f183ff8a98 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,7 @@ public final class OfferInfoBuilder { private String volume; private String minVolume; private long makerFee; - private String offerFeePaymentTxId; + private String offerFeeTxId; private long buyerSecurityDeposit; private long sellerSecurityDeposit; private String triggerPrice; @@ -111,8 +111,8 @@ public final class OfferInfoBuilder { return this; } - public OfferInfoBuilder withOfferFeePaymentTxId(String offerFeePaymentTxId) { - this.offerFeePaymentTxId = offerFeePaymentTxId; + public OfferInfoBuilder withOfferFeeTxId(String offerFeeTxId) { + this.offerFeeTxId = offerFeeTxId; 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 650e834d71..2ae5ca2dd2 100644 --- a/core/src/main/java/haveno/core/app/HavenoSetup.java +++ b/core/src/main/java/haveno/core/app/HavenoSetup.java @@ -521,10 +521,10 @@ public class HavenoSetup { // resync. // TODO (woodser): check for invalid maker fee txs with xmr? // openOfferManager.getObservableList().forEach(e -> { -// String offerFeePaymentTxId = e.getOffer().getOfferFeePaymentTxId(); -// if (btcWalletService.getConfidenceForTxId(offerFeePaymentTxId) == null) { // TODO (woodser): verify xmr maker fee tx +// 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(), offerFeePaymentTxId); +// e.getOffer().getShortId(), offerFeeTxId); // log.warn(message); // if (lockedUpFundsHandler != null) { // lockedUpFundsHandler.accept(message); diff --git a/core/src/main/java/haveno/core/app/WalletAppSetup.java b/core/src/main/java/haveno/core/app/WalletAppSetup.java index 4e629e261c..498ecc3399 100644 --- a/core/src/main/java/haveno/core/app/WalletAppSetup.java +++ b/core/src/main/java/haveno/core/app/WalletAppSetup.java @@ -212,7 +212,7 @@ public class WalletAppSetup { UserThread.runAfter(() -> { String txId = newValue.getTxId(); openOfferManager.getObservableList().stream() - .filter(openOffer -> txId.equals(openOffer.getOffer().getOfferFeePaymentTxId())) + .filter(openOffer -> txId.equals(openOffer.getOffer().getOfferFeeTxId())) .forEach(openOffer -> { // We delay to avoid concurrent modification exceptions UserThread.runAfter(() -> { @@ -237,7 +237,7 @@ public class WalletAppSetup { if (txId.equals(trade.getTaker().getDepositTxHash())) { details = Res.get("popup.warning.trade.txRejected.deposit"); } - if (txId.equals(trade.getOffer().getOfferFeePaymentTxId())) { + if (txId.equals(trade.getOffer().getOfferFeeTxId())) { details = Res.get("popup.warning.trade.txRejected.tradeFee"); } diff --git a/core/src/main/java/haveno/core/offer/Offer.java b/core/src/main/java/haveno/core/offer/Offer.java index 7d7cd9279f..e86cbb2db6 100644 --- a/core/src/main/java/haveno/core/offer/Offer.java +++ b/core/src/main/java/haveno/core/offer/Offer.java @@ -275,8 +275,8 @@ public class Offer implements NetworkPayload, PersistablePayload { return stateProperty; } - public void setOfferFeePaymentTxId(String offerFeePaymentTxID) { - offerPayload.setOfferFeePaymentTxId(offerFeePaymentTxID); + public void setOfferFeeTxId(String offerFeeTxId) { + offerPayload.setOfferFeeTxId(offerFeeTxId); } public void setErrorMessage(String errorMessage) { @@ -483,8 +483,8 @@ public class Offer implements NetworkPayload, PersistablePayload { return offerPayload.getMakerPaymentAccountId(); } - public String getOfferFeePaymentTxId() { - return offerPayload.getOfferFeePaymentTxId(); + public String getOfferFeeTxId() { + return offerPayload.getOfferFeeTxId(); } public String getVersionNr() { diff --git a/core/src/main/java/haveno/core/offer/OfferPayload.java b/core/src/main/java/haveno/core/offer/OfferPayload.java index 01af576c96..a108f2f2b8 100644 --- a/core/src/main/java/haveno/core/offer/OfferPayload.java +++ b/core/src/main/java/haveno/core/offer/OfferPayload.java @@ -120,7 +120,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay // Mutable property. Has to be set before offer is saved in P2P network as it changes the payload hash! @Setter @Nullable - private String offerFeePaymentTxId; + private String offerFeeTxId; @Nullable private final String countryCode; @Nullable @@ -170,7 +170,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay String counterCurrencyCode, String paymentMethodId, String makerPaymentAccountId, - @Nullable String offerFeePaymentTxId, + @Nullable String offerFeeTxId, @Nullable String countryCode, @Nullable List acceptedCountryCodes, @Nullable String bankId, @@ -213,7 +213,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay this.reserveTxKeyImages = reserveTxKeyImages; this.marketPriceMarginPct = marketPriceMarginPct; this.useMarketBasedPrice = useMarketBasedPrice; - this.offerFeePaymentTxId = offerFeePaymentTxId; + this.offerFeeTxId = offerFeeTxId; this.countryCode = countryCode; this.acceptedCountryCodes = acceptedCountryCodes; this.bankId = bankId; @@ -233,8 +233,8 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay } public byte[] getHash() { - if (this.hash == null && this.offerFeePaymentTxId != null) { - // A proto message can be created only after the offerFeePaymentTxId is + if (this.hash == null && this.offerFeeTxId != 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()); } @@ -295,7 +295,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay .setIsPrivateOffer(isPrivateOffer) .setProtocolVersion(protocolVersion); Optional.ofNullable(arbitratorSigner).ifPresent(e -> builder.setArbitratorSigner(arbitratorSigner.toProtoMessage())); - Optional.ofNullable(offerFeePaymentTxId).ifPresent(builder::setOfferFeePaymentTxId); + Optional.ofNullable(offerFeeTxId).ifPresent(builder::setOfferFeeTxId); Optional.ofNullable(countryCode).ifPresent(builder::setCountryCode); Optional.ofNullable(bankId).ifPresent(builder::setBankId); Optional.ofNullable(acceptedBankIds).ifPresent(builder::addAllAcceptedBankIds); @@ -331,7 +331,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay proto.getCounterCurrencyCode(), proto.getPaymentMethodId(), proto.getMakerPaymentAccountId(), - proto.getOfferFeePaymentTxId(), + ProtoUtil.stringOrNullFromProto(proto.getOfferFeeTxId()), ProtoUtil.stringOrNullFromProto(proto.getCountryCode()), acceptedCountryCodes, ProtoUtil.stringOrNullFromProto(proto.getBankId()), @@ -380,7 +380,7 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay ",\r\n reserveTxKeyImages=" + reserveTxKeyImages + ",\r\n marketPriceMargin=" + marketPriceMarginPct + ",\r\n useMarketBasedPrice=" + useMarketBasedPrice + - ",\r\n offerFeePaymentTxId='" + offerFeePaymentTxId + '\'' + + ",\r\n offerFeeTxId='" + offerFeeTxId + '\'' + ",\r\n countryCode='" + countryCode + '\'' + ",\r\n acceptedCountryCodes=" + acceptedCountryCodes + ",\r\n bankId='" + bankId + '\'' + @@ -422,7 +422,7 @@ 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("offerFeePaymentTxId", context.serialize(offerPayload.getOfferFeePaymentTxId())); + 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 ac50990644..61a0361144 100644 --- a/core/src/main/java/haveno/core/offer/OfferUtil.java +++ b/core/src/main/java/haveno/core/offer/OfferUtil.java @@ -248,12 +248,12 @@ public class OfferUtil { } public static Optional getInvalidMakerFeeTxErrorMessage(Offer offer, BtcWalletService btcWalletService) { - String offerFeePaymentTxId = offer.getOfferFeePaymentTxId(); - if (offerFeePaymentTxId == null) { + String offerFeeTxId = offer.getOfferFeeTxId(); + if (offerFeeTxId == null) { return Optional.empty(); } - Transaction makerFeeTx = btcWalletService.getTransaction(offerFeePaymentTxId); + Transaction makerFeeTx = btcWalletService.getTransaction(offerFeeTxId); if (makerFeeTx == null) { return Optional.empty(); } diff --git a/core/src/main/java/haveno/core/offer/OpenOfferManager.java b/core/src/main/java/haveno/core/offer/OpenOfferManager.java index 8fd38596e9..c52a491923 100644 --- a/core/src/main/java/haveno/core/offer/OpenOfferManager.java +++ b/core/src/main/java/haveno/core/offer/OpenOfferManager.java @@ -1322,7 +1322,7 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe originalOfferPayload.getCounterCurrencyCode(), originalOfferPayload.getPaymentMethodId(), originalOfferPayload.getMakerPaymentAccountId(), - originalOfferPayload.getOfferFeePaymentTxId(), + originalOfferPayload.getOfferFeeTxId(), originalOfferPayload.getCountryCode(), originalOfferPayload.getAcceptedCountryCodes(), originalOfferPayload.getBankId(), diff --git a/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java b/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java index 8b3d1bf65c..5a367be514 100644 --- a/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java +++ b/core/src/main/java/haveno/core/offer/placeoffer/tasks/MakerReserveOfferFunds.java @@ -65,7 +65,6 @@ public class MakerReserveOfferFunds extends Task { // save offer state model.setReserveTx(reserveTx); offer.getOfferPayload().setReserveTxKeyImages(reservedKeyImages); - offer.setOfferFeePaymentTxId(reserveTx.getHash()); // TODO (woodser): don't use this field complete(); } catch (Throwable t) { offer.setErrorMessage("An error occurred.\n" + diff --git a/core/src/main/java/haveno/core/provider/mempool/MempoolService.java b/core/src/main/java/haveno/core/provider/mempool/MempoolService.java index 17b0ad36ea..60c77fe73c 100644 --- a/core/src/main/java/haveno/core/provider/mempool/MempoolService.java +++ b/core/src/main/java/haveno/core/provider/mempool/MempoolService.java @@ -80,7 +80,7 @@ public class MempoolService { } public void validateOfferMakerTx(OfferPayload offerPayload, Consumer resultHandler) { - validateOfferMakerTx(new TxValidator( offerPayload.getOfferFeePaymentTxId(), Coin.valueOf(offerPayload.getAmount())), resultHandler); + validateOfferMakerTx(new TxValidator( offerPayload.getOfferFeeTxId(), Coin.valueOf(offerPayload.getAmount())), resultHandler); } public void validateOfferMakerTx(TxValidator txValidator, Consumer resultHandler) { diff --git a/core/src/main/java/haveno/core/trade/Contract.java b/core/src/main/java/haveno/core/trade/Contract.java index a1953c06f7..a607f9ece2 100644 --- a/core/src/main/java/haveno/core/trade/Contract.java +++ b/core/src/main/java/haveno/core/trade/Contract.java @@ -67,9 +67,6 @@ public final class Contract implements NetworkPayload { private final String makerDepositTxHash; private final String takerDepositTxHash; - // Added in v1.2.0 - private long lockTime; - public Contract(OfferPayload offerPayload, long tradeAmount, long tradePrice, @@ -87,7 +84,6 @@ public final class Contract implements NetworkPayload { PubKeyRing takerPubKeyRing, String makerPayoutAddressString, String takerPayoutAddressString, - long lockTime, String makerDepositTxHash, String takerDepositTxHash) { this.offerPayload = offerPayload; @@ -107,7 +103,6 @@ public final class Contract implements NetworkPayload { this.takerPubKeyRing = takerPubKeyRing; this.makerPayoutAddressString = makerPayoutAddressString; this.takerPayoutAddressString = takerPayoutAddressString; - this.lockTime = lockTime; this.makerDepositTxHash = makerDepositTxHash; this.takerDepositTxHash = takerDepositTxHash; @@ -143,7 +138,6 @@ public final class Contract implements NetworkPayload { PubKeyRing.fromProto(proto.getTakerPubKeyRing()), proto.getMakerPayoutAddressString(), proto.getTakerPayoutAddressString(), - proto.getLockTime(), proto.getMakerDepositTxHash(), proto.getTakerDepositTxHash()); } @@ -168,7 +162,6 @@ public final class Contract implements NetworkPayload { .setTakerPubKeyRing(takerPubKeyRing.toProtoMessage()) .setMakerPayoutAddressString(makerPayoutAddressString) .setTakerPayoutAddressString(takerPayoutAddressString) - .setLockTime(lockTime) .setMakerDepositTxHash(makerDepositTxHash) .setTakerDepositTxHash(takerDepositTxHash) .build(); @@ -303,7 +296,6 @@ public final class Contract implements NetworkPayload { ",\n takerPubKeyRing=" + takerPubKeyRing + ",\n makerPayoutAddressString='" + makerPayoutAddressString + '\'' + ",\n takerPayoutAddressString='" + takerPayoutAddressString + '\'' + - ",\n lockTime=" + lockTime + ",\n makerDepositTxHash='" + makerDepositTxHash + '\'' + ",\n takerDepositTxHash='" + takerDepositTxHash + '\'' + "\n}"; diff --git a/core/src/main/java/haveno/core/trade/Trade.java b/core/src/main/java/haveno/core/trade/Trade.java index c35897263b..2b5407b403 100644 --- a/core/src/main/java/haveno/core/trade/Trade.java +++ b/core/src/main/java/haveno/core/trade/Trade.java @@ -866,7 +866,6 @@ public abstract class Trade implements Tradable, Model { getTaker().getPubKeyRing(), this instanceof MakerTrade ? xmrWalletService.getAddressEntry(getId(), XmrAddressEntry.Context.TRADE_PAYOUT).get().getAddressString() : getMaker().getPayoutAddressString(), // maker payout address this instanceof TakerTrade ? xmrWalletService.getAddressEntry(getId(), XmrAddressEntry.Context.TRADE_PAYOUT).get().getAddressString() : getTaker().getPayoutAddressString(), // taker payout address - getLockTime(), getMaker().getDepositTxHash(), getTaker().getDepositTxHash() ); @@ -1594,9 +1593,7 @@ public abstract class Trade implements Tradable, Model { } public boolean isTxChainInvalid() { - return offer.getOfferFeePaymentTxId() == null || - processModel.getMaker().getDepositTxHash() == null || - processModel.getTaker().getDepositTxHash() == null; + return processModel.getMaker().getDepositTxHash() == null || processModel.getTaker().getDepositTxHash() == null; } /** diff --git a/core/src/main/java/haveno/core/trade/protocol/TradePeer.java b/core/src/main/java/haveno/core/trade/protocol/TradePeer.java index 858228769b..64f8ab8707 100644 --- a/core/src/main/java/haveno/core/trade/protocol/TradePeer.java +++ b/core/src/main/java/haveno/core/trade/protocol/TradePeer.java @@ -25,14 +25,12 @@ import haveno.common.proto.persistable.PersistablePayload; import haveno.core.account.witness.AccountAgeWitness; import haveno.core.payment.payload.PaymentAccountPayload; import haveno.core.proto.CoreProtoResolver; -import haveno.core.xmr.model.RawTransactionInput; import haveno.network.p2p.NodeAddress; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import java.util.Optional; -import java.util.stream.Collectors; import lombok.Getter; import lombok.Setter; @@ -82,15 +80,6 @@ public final class TradePeer implements PersistablePayload { private String contractAsJson; @Nullable private String contractSignature; - @Nullable - private byte[] signature; - @Nullable - private byte[] multiSigPubKey; - @Nullable - private List rawTransactionInputs; - private long changeOutputValue; - @Nullable - private String changeOutputAddress; // added in v 0.6 @Nullable @@ -145,8 +134,7 @@ public final class TradePeer implements PersistablePayload { @Override public Message toProtoMessage() { - final protobuf.TradePeer.Builder builder = protobuf.TradePeer.newBuilder() - .setChangeOutputValue(changeOutputValue); + final protobuf.TradePeer.Builder builder = protobuf.TradePeer.newBuilder(); Optional.ofNullable(nodeAddress).ifPresent(e -> builder.setNodeAddress(nodeAddress.toProtoMessage())); Optional.ofNullable(pubKeyRing).ifPresent(e -> builder.setPubKeyRing(pubKeyRing.toProtoMessage())); Optional.ofNullable(accountId).ifPresent(builder::setAccountId); @@ -159,11 +147,7 @@ public final class TradePeer implements PersistablePayload { Optional.ofNullable(payoutAddressString).ifPresent(builder::setPayoutAddressString); Optional.ofNullable(contractAsJson).ifPresent(builder::setContractAsJson); Optional.ofNullable(contractSignature).ifPresent(builder::setContractSignature); - Optional.ofNullable(signature).ifPresent(e -> builder.setSignature(ByteString.copyFrom(e))); Optional.ofNullable(pubKeyRing).ifPresent(e -> builder.setPubKeyRing(e.toProtoMessage())); - Optional.ofNullable(multiSigPubKey).ifPresent(e -> builder.setMultiSigPubKey(ByteString.copyFrom(e))); - Optional.ofNullable(rawTransactionInputs).ifPresent(e -> builder.addAllRawTransactionInputs(ProtoUtil.collectionToProto(e, protobuf.RawTransactionInput.class))); - Optional.ofNullable(changeOutputAddress).ifPresent(builder::setChangeOutputAddress); Optional.ofNullable(accountAgeWitnessNonce).ifPresent(e -> builder.setAccountAgeWitnessNonce(ByteString.copyFrom(e))); Optional.ofNullable(accountAgeWitnessSignature).ifPresent(e -> builder.setAccountAgeWitnessSignature(ByteString.copyFrom(e))); Optional.ofNullable(accountAgeWitness).ifPresent(e -> builder.setAccountAgeWitness(accountAgeWitness.toProtoAccountAgeWitness())); @@ -192,7 +176,6 @@ public final class TradePeer implements PersistablePayload { TradePeer tradePeer = new TradePeer(); tradePeer.setNodeAddress(proto.hasNodeAddress() ? NodeAddress.fromProto(proto.getNodeAddress()) : null); tradePeer.setPubKeyRing(proto.hasPubKeyRing() ? PubKeyRing.fromProto(proto.getPubKeyRing()) : null); - tradePeer.setChangeOutputValue(proto.getChangeOutputValue()); tradePeer.setAccountId(ProtoUtil.stringOrNullFromProto(proto.getAccountId())); tradePeer.setPaymentAccountId(ProtoUtil.stringOrNullFromProto(proto.getPaymentAccountId())); tradePeer.setPaymentMethodId(ProtoUtil.stringOrNullFromProto(proto.getPaymentMethodId())); @@ -203,16 +186,7 @@ public final class TradePeer implements PersistablePayload { tradePeer.setPayoutAddressString(ProtoUtil.stringOrNullFromProto(proto.getPayoutAddressString())); tradePeer.setContractAsJson(ProtoUtil.stringOrNullFromProto(proto.getContractAsJson())); tradePeer.setContractSignature(ProtoUtil.stringOrNullFromProto(proto.getContractSignature())); - tradePeer.setSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getSignature())); tradePeer.setPubKeyRing(proto.hasPubKeyRing() ? PubKeyRing.fromProto(proto.getPubKeyRing()) : null); - tradePeer.setMultiSigPubKey(ProtoUtil.byteArrayOrNullFromProto(proto.getMultiSigPubKey())); - List rawTransactionInputs = proto.getRawTransactionInputsList().isEmpty() ? - null : - proto.getRawTransactionInputsList().stream() - .map(RawTransactionInput::fromProto) - .collect(Collectors.toList()); - tradePeer.setRawTransactionInputs(rawTransactionInputs); - tradePeer.setChangeOutputAddress(ProtoUtil.stringOrNullFromProto(proto.getChangeOutputAddress())); tradePeer.setAccountAgeWitnessNonce(ProtoUtil.byteArrayOrNullFromProto(proto.getAccountAgeWitnessNonce())); tradePeer.setAccountAgeWitnessSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getAccountAgeWitnessSignature())); protobuf.AccountAgeWitness protoAccountAgeWitness = proto.getAccountAgeWitness(); diff --git a/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java b/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java index 0e07b93c4c..722861f14c 100644 --- a/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java +++ b/core/src/main/java/haveno/core/trade/statistics/TradeStatisticsManager.java @@ -91,8 +91,10 @@ public class TradeStatisticsManager { if (!tradeStatistics.isValid()) { return; } - observableTradeStatisticsSet.add(tradeStatistics); - priceFeedService.applyLatestHavenoMarketPrice(observableTradeStatisticsSet); + synchronized (observableTradeStatisticsSet) { + observableTradeStatisticsSet.add(tradeStatistics); + priceFeedService.applyLatestHavenoMarketPrice(observableTradeStatisticsSet); + } maybeDumpStatistics(); } }); @@ -102,8 +104,10 @@ public class TradeStatisticsManager { .map(e -> (TradeStatistics3) e) .filter(TradeStatistics3::isValid) .collect(Collectors.toSet()); - observableTradeStatisticsSet.addAll(set); - priceFeedService.applyLatestHavenoMarketPrice(observableTradeStatisticsSet); + synchronized (observableTradeStatisticsSet) { + observableTradeStatisticsSet.addAll(set); + priceFeedService.applyLatestHavenoMarketPrice(observableTradeStatisticsSet); + } maybeDumpStatistics(); } 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 c02eccc383..edbfcb90d1 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 @@ -31,7 +31,7 @@ class TransactionAwareOpenOffer implements TransactionAwareTradable { public boolean isRelatedToTransaction(MoneroTxWallet transaction) { Offer offer = delegate.getOffer(); - String paymentTxId = offer.getOfferFeePaymentTxId(); + String paymentTxId = offer.getOfferFeeTxId(); String txId = transaction.getHash(); 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 6156dcac68..db54cee1ab 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 @@ -91,7 +91,7 @@ class TransactionAwareTrade implements TransactionAwareTradable { private boolean isOfferFeeTx(String txId) { return Optional.ofNullable(trade.getOffer()) - .map(Offer::getOfferFeePaymentTxId) + .map(Offer::getOfferFeeTxId) .map(paymentTxId -> paymentTxId.equals(txId)) .orElse(false); } 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 0dd0bccc84..67765f2345 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 @@ -116,8 +116,8 @@ class TransactionsListItem { Trade trade = (Trade) tradable; Offer offer = trade.getOffer(); - String offerFeePaymentTxID = offer.getOfferFeePaymentTxId(); - if (offerFeePaymentTxID != null && offerFeePaymentTxID.equals(txId)) { + String offerFeeTxId = offer.getOfferFeeTxId(); + if (offerFeeTxId != null && offerFeeTxId.equals(txId)) { details = Res.get("funds.tx.createOfferFee", tradeId); } else if (trade.getSelf().getDepositTxHash() != null && trade.getSelf().getDepositTxHash().equals(txId)) { diff --git a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferDataModel.java b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferDataModel.java index de507d5757..1cebb581b8 100644 --- a/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferDataModel.java +++ b/desktop/src/main/java/haveno/desktop/main/offer/takeoffer/TakeOfferDataModel.java @@ -202,7 +202,7 @@ class TakeOfferDataModel extends OfferDataModel { mempoolStatus.setValue(txValidator.isFail() ? 0 : 1); if (txValidator.isFail()) { mempoolStatusText = txValidator.toString(); - log.info("Mempool check of OfferFeePaymentTxId returned errors: [{}]", mempoolStatusText); + log.info("Mempool check of OfferFeeTxId returned errors: [{}]", mempoolStatusText); } })); 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 6e43c2f4b4..730cef0905 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,7 @@ class EditOfferDataModel extends MutableOfferDataModel { newOfferPayload.getCounterCurrencyCode(), newOfferPayload.getPaymentMethodId(), newOfferPayload.getMakerPaymentAccountId(), - offerPayload.getOfferFeePaymentTxId(), + 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 dd020204c3..b903fb186a 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 @@ -325,7 +325,7 @@ public class FailedTradesView extends ActivatableViewAndModel id = newProperty(); public static final Property paymentMethodId = newProperty(); public static final Property paymentAccountId = newProperty(); - public static final Property offerFeePaymentTxId = 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(); @@ -86,7 +86,7 @@ public class OfferMaker { lookup.valueOf(counterCurrencyCode, "USD"), lookup.valueOf(paymentMethodId, "SEPA"), lookup.valueOf(paymentAccountId, "00002c4d-1ffc-4208-8ff3-e669817b0000"), - lookup.valueOf(offerFeePaymentTxId, "0000dcd1d388b95714c96ce13f5cb000090c41a1faf89e4ce7680938cc170000"), + 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 bd3fb195e0..ff42b98ba7 100644 --- a/proto/src/main/proto/grpc.proto +++ b/proto/src/main/proto/grpc.proto @@ -532,7 +532,7 @@ message OfferInfo { uint64 date = 17; string state = 18; uint64 seller_security_deposit = 19 [jstype = JS_STRING]; - string offer_fee_payment_tx_id = 20; + string offer_fee_tx_id = 20; uint64 maker_fee = 22 [jstype = JS_STRING]; bool is_activated = 23; bool is_my_offer = 24; diff --git a/proto/src/main/proto/pb.proto b/proto/src/main/proto/pb.proto index 16256aee0c..9b53cf1410 100644 --- a/proto/src/main/proto/pb.proto +++ b/proto/src/main/proto/pb.proto @@ -614,7 +614,7 @@ message OfferPayload { string counter_currency_code = 12; string payment_method_id = 13; string maker_payment_account_id = 14; - string offer_fee_payment_tx_id = 15; + string offer_fee_tx_id = 15; string country_code = 16; repeated string accepted_country_codes = 17; string bank_id = 18; @@ -784,7 +784,6 @@ message Contract { string taker_payout_address_string = 17; string maker_deposit_tx_hash = 18; string taker_deposit_tx_hash = 19; - int64 lock_time = 20; } message RawTransactionInput { @@ -1558,11 +1557,6 @@ message TradePeer { string payout_address_string = 10; string contract_as_json = 11; string contract_signature = 12; - bytes signature = 13; // TODO (woodser): remove unused fields? this was buyer-signed payout tx as bytes - bytes multi_sig_pub_key = 14; - repeated RawTransactionInput raw_transaction_inputs = 15; - int64 change_output_value = 16; - string change_output_address = 17; bytes account_age_witness_nonce = 18; bytes account_age_witness_signature = 19; AccountAgeWitness account_age_witness = 20;