mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-17 19:54:35 -05:00
remove unused fields from TradePeer and Contract
fix concurrent modification exception applying prices to trade stats standardize offer fee tx ids (unused)
This commit is contained in:
parent
a16b03bb5c
commit
47f3d98597
@ -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();
|
||||
|
@ -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())
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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<String> 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()));
|
||||
|
@ -248,12 +248,12 @@ public class OfferUtil {
|
||||
}
|
||||
|
||||
public static Optional<String> 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();
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -65,7 +65,6 @@ public class MakerReserveOfferFunds extends Task<PlaceOfferModel> {
|
||||
// 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" +
|
||||
|
@ -80,7 +80,7 @@ public class MempoolService {
|
||||
}
|
||||
|
||||
public void validateOfferMakerTx(OfferPayload offerPayload, Consumer<TxValidator> 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<TxValidator> resultHandler) {
|
||||
|
@ -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}";
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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<RawTransactionInput> 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<RawTransactionInput> 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();
|
||||
|
@ -91,8 +91,10 @@ public class TradeStatisticsManager {
|
||||
if (!tradeStatistics.isValid()) {
|
||||
return;
|
||||
}
|
||||
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());
|
||||
synchronized (observableTradeStatisticsSet) {
|
||||
observableTradeStatisticsSet.addAll(set);
|
||||
priceFeedService.applyLatestHavenoMarketPrice(observableTradeStatisticsSet);
|
||||
}
|
||||
maybeDumpStatistics();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
}
|
||||
}));
|
||||
|
||||
|
@ -192,7 +192,7 @@ class EditOfferDataModel extends MutableOfferDataModel {
|
||||
newOfferPayload.getCounterCurrencyCode(),
|
||||
newOfferPayload.getPaymentMethodId(),
|
||||
newOfferPayload.getMakerPaymentAccountId(),
|
||||
offerPayload.getOfferFeePaymentTxId(),
|
||||
offerPayload.getOfferFeeTxId(),
|
||||
newOfferPayload.getCountryCode(),
|
||||
newOfferPayload.getAcceptedCountryCodes(),
|
||||
newOfferPayload.getBankId(),
|
||||
|
@ -325,7 +325,7 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
|
||||
if (model.getDirectionLabel(item).contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
if (offer.getOfferFeePaymentTxId().contains(filterString)) {
|
||||
if (offer.getOfferFeeTxId() != null && offer.getOfferFeeTxId().contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
|
||||
if (model.getDirectionLabel(item).contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
if (offer.getOfferFeePaymentTxId().contains(filterString)) {
|
||||
if (offer.getOfferFeeTxId() != null && offer.getOfferFeeTxId().contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -18,7 +18,6 @@
|
||||
package haveno.desktop.util.filtering;
|
||||
|
||||
import haveno.core.offer.Offer;
|
||||
import haveno.core.trade.Contract;
|
||||
import haveno.core.trade.Trade;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@ -30,7 +29,7 @@ public class FilteringUtils {
|
||||
if (StringUtils.containsIgnoreCase(offer.getPaymentMethod().getDisplayString(), filterString)) {
|
||||
return true;
|
||||
}
|
||||
return offer.getOfferFeePaymentTxId() != null && StringUtils.containsIgnoreCase(offer.getOfferFeePaymentTxId(), filterString);
|
||||
return offer.getOfferFeeTxId() != null && StringUtils.containsIgnoreCase(offer.getOfferFeeTxId(), filterString);
|
||||
}
|
||||
|
||||
public static boolean match(Trade trade, String filterString) {
|
||||
|
@ -82,7 +82,7 @@ public class TransactionAwareTradeTest {
|
||||
|
||||
@Test
|
||||
public void testIsRelatedToTransactionWhenOfferFeeTx() {
|
||||
when(delegate.getOffer().getOfferFeePaymentTxId()).thenReturn(XID.toString());
|
||||
when(delegate.getOffer().getOfferFeeTxId()).thenReturn(XID.toString());
|
||||
assertTrue(trade.isRelatedToTransaction(transaction));
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ 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> offerFeePaymentTxId = 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();
|
||||
@ -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");
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user