mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +00:00
remove unused protobuf fields
remove TraderSignedWitnessMessage remove tx fee from offer and trade set dispute's disputePayoutTxId when payout observed synchronize access to PersistenceManager.persistNow() fix concurrent modification exception in OfferBookChartView
This commit is contained in:
parent
0372af663a
commit
6f16a5ee92
30 changed files with 63 additions and 294 deletions
|
@ -63,8 +63,6 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
|
|||
@Nullable
|
||||
protected final Column<String> colMixedAmount;
|
||||
@Nullable
|
||||
protected final Column<Long> colMinerTxFee;
|
||||
@Nullable
|
||||
protected final MixedTradeFeeColumn colMixedTradeFee;
|
||||
@Nullable
|
||||
protected final Column<Long> colBuyerDeposit;
|
||||
|
@ -115,7 +113,6 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
|
|||
this.colCurrency = colSupplier.currencyColumn.get();
|
||||
this.colAmount = colSupplier.amountColumn.get();
|
||||
this.colMixedAmount = colSupplier.mixedAmountColumn.get();
|
||||
this.colMinerTxFee = colSupplier.minerTxFeeColumn.get();
|
||||
this.colMixedTradeFee = colSupplier.mixedTradeFeeColumn.get();
|
||||
this.colBuyerDeposit = colSupplier.toSecurityDepositColumn.apply(COL_HEADER_BUYER_DEPOSIT);
|
||||
this.colSellerDeposit = colSupplier.toSecurityDepositColumn.apply(COL_HEADER_SELLER_DEPOSIT);
|
||||
|
@ -194,12 +191,6 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
|
|||
? format("%.2f%s", t.getOffer().getMarketPriceMarginPct(), "%")
|
||||
: "N/A";
|
||||
|
||||
protected final Function<TradeInfo, Long> toMyMinerTxFee = (t) -> {
|
||||
return isTaker.test(t)
|
||||
? t.getTxFeeAsLong()
|
||||
: t.getOffer().getTxFee();
|
||||
};
|
||||
|
||||
protected final Function<TradeInfo, Long> toTradeFeeBtc = (t) -> {
|
||||
var isMyOffer = t.getOffer().getIsMyOffer();
|
||||
if (isMyOffer) {
|
||||
|
|
|
@ -43,7 +43,6 @@ class ClosedTradeTableBuilder extends AbstractTradeListBuilder {
|
|||
colAmount.asStringColumn(),
|
||||
colMixedAmount.justify(),
|
||||
colCurrency,
|
||||
colMinerTxFee.asStringColumn(),
|
||||
colMixedTradeFee.asStringColumn(),
|
||||
colBuyerDeposit.asStringColumn(),
|
||||
colSellerDeposit.asStringColumn(),
|
||||
|
@ -61,7 +60,6 @@ class ClosedTradeTableBuilder extends AbstractTradeListBuilder {
|
|||
colAmount.addRow(t.getAmountAsLong());
|
||||
colMixedAmount.addRow(t.getTradeVolume());
|
||||
colCurrency.addRow(toPaymentCurrencyCode.apply(t));
|
||||
colMinerTxFee.addRow(toMyMinerTxFee.apply(t));
|
||||
|
||||
colMixedTradeFee.addRow(toTradeFeeBtc.apply(t), false);
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ class TradeDetailTableBuilder extends AbstractTradeListBuilder {
|
|||
colRole.addRow(trade.getRole());
|
||||
colPrice.addRow(trade.getPrice());
|
||||
colAmount.addRow(toTradeAmount.apply(trade));
|
||||
colMinerTxFee.addRow(toMyMinerTxFee.apply(trade));
|
||||
colBisqTradeFee.addRow(toMyMakerOrTakerFee.apply(trade));
|
||||
colIsDepositPublished.addRow(trade.getIsDepositsPublished());
|
||||
colIsDepositConfirmed.addRow(trade.getIsDepositsUnlocked());
|
||||
|
@ -86,7 +85,6 @@ class TradeDetailTableBuilder extends AbstractTradeListBuilder {
|
|||
add(colRole);
|
||||
add(colPrice.justify());
|
||||
add(colAmount.asStringColumn());
|
||||
add(colMinerTxFee.asStringColumn());
|
||||
add(colBisqTradeFee.asStringColumn());
|
||||
add(colIsDepositPublished.asStringColumn());
|
||||
add(colIsDepositConfirmed.asStringColumn());
|
||||
|
|
|
@ -457,7 +457,7 @@ public class PersistenceManager<T extends PersistableEnvelope> {
|
|||
persistNow(completeHandler, false);
|
||||
}
|
||||
|
||||
private void persistNow(@Nullable Runnable completeHandler, boolean force) {
|
||||
private synchronized void persistNow(@Nullable Runnable completeHandler, boolean force) {
|
||||
long ts = System.currentTimeMillis();
|
||||
try {
|
||||
// The serialisation is done on the user thread to avoid threading issue with potential mutations of the
|
||||
|
|
|
@ -156,7 +156,6 @@ public class OfferInfo implements Payload {
|
|||
.withVolume(roundedVolume)
|
||||
.withMinVolume(roundedMinVolume)
|
||||
.withMakerFee(HavenoUtils.centinerosToAtomicUnits(offer.getMakerFee().value).longValueExact())
|
||||
.withTxFee(HavenoUtils.centinerosToAtomicUnits(offer.getTxFee().value).longValueExact())
|
||||
.withOfferFeePaymentTxId(offer.getOfferFeePaymentTxId())
|
||||
.withBuyerSecurityDeposit(HavenoUtils.centinerosToAtomicUnits(offer.getBuyerSecurityDeposit().value).longValueExact())
|
||||
.withSellerSecurityDeposit(HavenoUtils.centinerosToAtomicUnits(offer.getSellerSecurityDeposit().value).longValueExact())
|
||||
|
|
|
@ -65,7 +65,6 @@ public class TradeInfo implements Payload {
|
|||
private final String shortId;
|
||||
private final long date;
|
||||
private final String role;
|
||||
private final long txFeeAsLong;
|
||||
private final long takerFeeAsLong;
|
||||
private final String makerDepositTxId;
|
||||
private final String takerDepositTxId;
|
||||
|
@ -100,7 +99,6 @@ public class TradeInfo implements Payload {
|
|||
this.shortId = builder.getShortId();
|
||||
this.date = builder.getDate();
|
||||
this.role = builder.getRole();
|
||||
this.txFeeAsLong = builder.getTxFeeAsLong();
|
||||
this.takerFeeAsLong = builder.getTakerFeeAsLong();
|
||||
this.makerDepositTxId = builder.getMakerDepositTxId();
|
||||
this.takerDepositTxId = builder.getTakerDepositTxId();
|
||||
|
@ -158,7 +156,6 @@ public class TradeInfo implements Payload {
|
|||
.withShortId(trade.getShortId())
|
||||
.withDate(trade.getDate().getTime())
|
||||
.withRole(role == null ? "" : role)
|
||||
.withTxFeeAsLong(trade.getTxFeeAsLong())
|
||||
.withTakerFeeAsLong(trade.getTakerFeeAsLong())
|
||||
.withMakerDepositTxId(trade.getMaker().getDepositTxHash())
|
||||
.withTakerDepositTxId(trade.getTaker().getDepositTxHash())
|
||||
|
@ -202,7 +199,6 @@ public class TradeInfo implements Payload {
|
|||
.setShortId(shortId)
|
||||
.setDate(date)
|
||||
.setRole(role)
|
||||
.setTxFeeAsLong(txFeeAsLong)
|
||||
.setTakerFeeAsLong(takerFeeAsLong)
|
||||
.setMakerDepositTxId(makerDepositTxId == null ? "" : makerDepositTxId)
|
||||
.setTakerDepositTxId(takerDepositTxId == null ? "" : takerDepositTxId)
|
||||
|
@ -240,7 +236,6 @@ public class TradeInfo implements Payload {
|
|||
.withShortId(proto.getShortId())
|
||||
.withDate(proto.getDate())
|
||||
.withRole(proto.getRole())
|
||||
.withTxFeeAsLong(proto.getTxFeeAsLong())
|
||||
.withTakerFeeAsLong(proto.getTakerFeeAsLong())
|
||||
.withMakerDepositTxId(proto.getMakerDepositTxId())
|
||||
.withTakerDepositTxId(proto.getTakerDepositTxId())
|
||||
|
@ -278,7 +273,6 @@ public class TradeInfo implements Payload {
|
|||
", shortId='" + shortId + '\'' + "\n" +
|
||||
", date='" + date + '\'' + "\n" +
|
||||
", role='" + role + '\'' + "\n" +
|
||||
", txFeeAsLong='" + txFeeAsLong + '\'' + "\n" +
|
||||
", takerFeeAsLong='" + takerFeeAsLong + '\'' + "\n" +
|
||||
", makerDepositTxId='" + makerDepositTxId + '\'' + "\n" +
|
||||
", takerDepositTxId='" + takerDepositTxId + '\'' + "\n" +
|
||||
|
|
|
@ -201,7 +201,6 @@ public class CreateOfferService {
|
|||
acceptedBanks,
|
||||
Version.VERSION,
|
||||
xmrWalletService.getWallet().getHeight(),
|
||||
0, // todo: remove txFeeToUse from data model
|
||||
makerFeeAsCoin.value,
|
||||
buyerSecurityDepositAsCoin.value,
|
||||
sellerSecurityDepositAsCoin.value,
|
||||
|
|
|
@ -297,11 +297,6 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
|||
return reserveAmount;
|
||||
}
|
||||
|
||||
// converted payload properties
|
||||
public Coin getTxFee() {
|
||||
return Coin.valueOf(offerPayload.getTxFee());
|
||||
}
|
||||
|
||||
public Coin getMakerFee() {
|
||||
return Coin.valueOf(offerPayload.getMakerFee());
|
||||
}
|
||||
|
|
|
@ -131,7 +131,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
|||
@Nullable
|
||||
private final List<String> acceptedBankIds;
|
||||
private final long blockHeightAtOfferCreation;
|
||||
private final long txFee;
|
||||
private final long makerFee;
|
||||
private final long buyerSecurityDeposit;
|
||||
private final long sellerSecurityDeposit;
|
||||
|
@ -179,7 +178,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
|||
@Nullable List<String> acceptedBankIds,
|
||||
String versionNr,
|
||||
long blockHeightAtOfferCreation,
|
||||
long txFee,
|
||||
long makerFee,
|
||||
long buyerSecurityDeposit,
|
||||
long sellerSecurityDeposit,
|
||||
|
@ -222,7 +220,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
|||
this.bankId = bankId;
|
||||
this.acceptedBankIds = acceptedBankIds;
|
||||
this.blockHeightAtOfferCreation = blockHeightAtOfferCreation;
|
||||
this.txFee = txFee;
|
||||
this.makerFee = makerFee;
|
||||
this.buyerSecurityDeposit = buyerSecurityDeposit;
|
||||
this.sellerSecurityDeposit = sellerSecurityDeposit;
|
||||
|
@ -287,7 +284,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
|||
.setMakerPaymentAccountId(makerPaymentAccountId)
|
||||
.setVersionNr(versionNr)
|
||||
.setBlockHeightAtOfferCreation(blockHeightAtOfferCreation)
|
||||
.setTxFee(txFee)
|
||||
.setMakerFee(makerFee)
|
||||
.setBuyerSecurityDeposit(buyerSecurityDeposit)
|
||||
.setSellerSecurityDeposit(sellerSecurityDeposit)
|
||||
|
@ -343,7 +339,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
|||
acceptedBankIds,
|
||||
proto.getVersionNr(),
|
||||
proto.getBlockHeightAtOfferCreation(),
|
||||
proto.getTxFee(),
|
||||
proto.getMakerFee(),
|
||||
proto.getBuyerSecurityDeposit(),
|
||||
proto.getSellerSecurityDeposit(),
|
||||
|
@ -392,7 +387,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
|||
",\r\n bankId='" + bankId + '\'' +
|
||||
",\r\n acceptedBankIds=" + acceptedBankIds +
|
||||
",\r\n blockHeightAtOfferCreation=" + blockHeightAtOfferCreation +
|
||||
",\r\n txFee=" + txFee +
|
||||
",\r\n makerFee=" + makerFee +
|
||||
",\r\n buyerSecurityDeposit=" + buyerSecurityDeposit +
|
||||
",\r\n sellerSecurityDeposit=" + sellerSecurityDeposit +
|
||||
|
@ -432,7 +426,6 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
|||
object.add("offerFeePaymentTxId", context.serialize(offerPayload.getOfferFeePaymentTxId()));
|
||||
object.add("versionNr", context.serialize(offerPayload.getVersionNr()));
|
||||
object.add("blockHeightAtOfferCreation", context.serialize(offerPayload.getBlockHeightAtOfferCreation()));
|
||||
object.add("txFee", context.serialize(offerPayload.getTxFee()));
|
||||
object.add("makerFee", context.serialize(offerPayload.getMakerFee()));
|
||||
object.add("buyerSecurityDeposit", context.serialize(offerPayload.getBuyerSecurityDeposit()));
|
||||
object.add("sellerSecurityDeposit", context.serialize(offerPayload.getSellerSecurityDeposit()));
|
||||
|
|
|
@ -1321,7 +1321,6 @@ public class OpenOfferManager implements PeerManager.Listener, DecryptedDirectMe
|
|||
originalOfferPayload.getAcceptedBankIds(),
|
||||
originalOfferPayload.getVersionNr(),
|
||||
originalOfferPayload.getBlockHeightAtOfferCreation(),
|
||||
originalOfferPayload.getTxFee(),
|
||||
originalOfferPayload.getMakerFee(),
|
||||
originalOfferPayload.getBuyerSecurityDeposit(),
|
||||
originalOfferPayload.getSellerSecurityDeposit(),
|
||||
|
|
|
@ -84,7 +84,6 @@ public class ValidateOffer extends Task<PlaceOfferModel> {
|
|||
checkNotNull(offer.getPubKeyRing(), "pubKeyRing is null");
|
||||
checkNotNull(offer.getMinAmount(), "MinAmount is null");
|
||||
checkNotNull(offer.getPrice(), "Price is null");
|
||||
checkNotNull(offer.getTxFee(), "txFee is null");
|
||||
checkNotNull(offer.getMakerFee(), "MakerFee is null");
|
||||
checkNotNull(offer.getVersionNr(), "VersionNr is null");
|
||||
checkArgument(offer.getMaxTradePeriod() > 0,
|
||||
|
|
|
@ -46,7 +46,6 @@ import bisq.core.trade.messages.PaymentReceivedMessage;
|
|||
import bisq.core.trade.messages.RefreshTradeStateRequest;
|
||||
import bisq.core.trade.messages.SignContractRequest;
|
||||
import bisq.core.trade.messages.SignContractResponse;
|
||||
import bisq.core.trade.messages.TraderSignedWitnessMessage;
|
||||
|
||||
import bisq.network.p2p.AckMessage;
|
||||
import bisq.network.p2p.BundleOfEnvelopes;
|
||||
|
@ -158,9 +157,6 @@ public class CoreNetworkProtoResolver extends CoreProtoResolver implements Netwo
|
|||
case PAYMENT_RECEIVED_MESSAGE:
|
||||
return PaymentReceivedMessage.fromProto(proto.getPaymentReceivedMessage(), messageVersion);
|
||||
|
||||
case TRADER_SIGNED_WITNESS_MESSAGE:
|
||||
return TraderSignedWitnessMessage.fromProto(proto.getTraderSignedWitnessMessage(), messageVersion);
|
||||
|
||||
case MEDIATED_PAYOUT_TX_SIGNATURE_MESSAGE:
|
||||
return MediatedPayoutTxSignatureMessage.fromProto(proto.getMediatedPayoutTxSignatureMessage(), messageVersion);
|
||||
case MEDIATED_PAYOUT_TX_PUBLISHED_MESSAGE:
|
||||
|
|
|
@ -325,8 +325,6 @@ public abstract class Trade implements Tradable, Model {
|
|||
@Getter
|
||||
private final Offer offer;
|
||||
@Getter
|
||||
private final long txFeeAsLong;
|
||||
@Getter
|
||||
private final long takerFeeAsLong;
|
||||
|
||||
// Added in 1.5.1
|
||||
|
@ -486,7 +484,6 @@ public abstract class Trade implements Tradable, Model {
|
|||
this.processModel = processModel;
|
||||
this.uid = uid;
|
||||
|
||||
this.txFeeAsLong = txFee.value;
|
||||
this.takerFeeAsLong = takerFee.value;
|
||||
this.takeOfferDate = new Date().getTime();
|
||||
this.tradeListeners = new ArrayList<TradeListener>();
|
||||
|
@ -830,10 +827,10 @@ public abstract class Trade implements Tradable, Model {
|
|||
isBuyerMakerAndSellerTaker,
|
||||
this instanceof MakerTrade ? processModel.getAccountId() : getMaker().getAccountId(), // maker account id
|
||||
this instanceof TakerTrade ? processModel.getAccountId() : getTaker().getAccountId(), // taker account id
|
||||
checkNotNull(this instanceof MakerTrade ? processModel.getPaymentAccountPayload(this).getPaymentMethodId() : getOffer().getOfferPayload().getPaymentMethodId()), // maker payment method id
|
||||
checkNotNull(this instanceof TakerTrade ? processModel.getPaymentAccountPayload(this).getPaymentMethodId() : getTaker().getPaymentMethodId()), // taker payment method id
|
||||
this instanceof MakerTrade ? processModel.getPaymentAccountPayload(this).getHash() : getMaker().getPaymentAccountPayloadHash(), // maker payment account payload hash
|
||||
this instanceof TakerTrade ? processModel.getPaymentAccountPayload(this).getHash() : getTaker().getPaymentAccountPayloadHash(), // maker payment account payload hash
|
||||
checkNotNull(this instanceof MakerTrade ? getMaker().getPaymentAccountPayload().getPaymentMethodId() : getOffer().getOfferPayload().getPaymentMethodId()),
|
||||
checkNotNull(this instanceof TakerTrade ? getTaker().getPaymentAccountPayload().getPaymentMethodId() : getTaker().getPaymentMethodId()),
|
||||
this instanceof MakerTrade ? getMaker().getPaymentAccountPayload().getHash() : getMaker().getPaymentAccountPayloadHash(),
|
||||
this instanceof TakerTrade ? getTaker().getPaymentAccountPayload().getHash() : getTaker().getPaymentAccountPayloadHash(),
|
||||
getMaker().getPubKeyRing(),
|
||||
getTaker().getPubKeyRing(),
|
||||
this instanceof MakerTrade ? xmrWalletService.getAddressEntry(getId(), XmrAddressEntry.Context.TRADE_PAYOUT).get().getAddressString() : getMaker().getPayoutAddressString(), // maker payout address
|
||||
|
@ -1219,6 +1216,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
payoutTxId = payoutTx.getHash();
|
||||
if ("".equals(payoutTxId)) payoutTxId = null; // tx hash is empty until signed
|
||||
payoutTxKey = payoutTx.getKey();
|
||||
for (Dispute dispute : getDisputes()) dispute.setDisputePayoutTxId(payoutTxId);
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
|
@ -1751,7 +1749,6 @@ public abstract class Trade implements Tradable, Model {
|
|||
public Message toProtoMessage() {
|
||||
protobuf.Trade.Builder builder = protobuf.Trade.newBuilder()
|
||||
.setOffer(offer.toProtoMessage())
|
||||
.setTxFeeAsLong(txFeeAsLong)
|
||||
.setTakerFeeAsLong(takerFeeAsLong)
|
||||
.setTakeOfferDate(takeOfferDate)
|
||||
.setProcessModel(processModel.toProtoMessage())
|
||||
|
@ -1821,7 +1818,6 @@ public abstract class Trade implements Tradable, Model {
|
|||
public String toString() {
|
||||
return "Trade{" +
|
||||
"\n offer=" + offer +
|
||||
",\n txFeeAsLong=" + txFeeAsLong +
|
||||
",\n takerFeeAsLong=" + takerFeeAsLong +
|
||||
",\n takeOfferDate=" + takeOfferDate +
|
||||
",\n processModel=" + processModel +
|
||||
|
|
|
@ -596,12 +596,10 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||
request.getTakerNodeAddress(),
|
||||
request.getArbitratorNodeAddress());
|
||||
|
||||
//System.out.println("TradeManager trade.getTradePeer().setNodeAddress(): " + sender);
|
||||
//trade.getTradePeer().setNodeAddress(sender);
|
||||
// TODO (woodser): what if maker's address changes while offer open, or taker's address changes after multisig deposit available? need to verify and update. see OpenOfferManager.maybeUpdatePersistedOffers()
|
||||
trade.getArbitrator().setPubKeyRing(arbitrator.getPubKeyRing());
|
||||
trade.getMaker().setPubKeyRing(trade.getOffer().getPubKeyRing());
|
||||
initTradeAndProtocol(trade, getTradeProtocol(trade));
|
||||
trade.getSelf().setPaymentAccountId(offer.getOfferPayload().getMakerPaymentAccountId());
|
||||
trade.getSelf().setReserveTxHash(openOffer.getReserveTxHash()); // TODO (woodser): initialize in initTradeAndProtocol?
|
||||
trade.getSelf().setReserveTxHex(openOffer.getReserveTxHex());
|
||||
trade.getSelf().setReserveTxKey(openOffer.getReserveTxKey());
|
||||
|
@ -783,8 +781,8 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||
trade.getProcessModel().setUseSavingsWallet(useSavingsWallet);
|
||||
trade.getProcessModel().setFundsNeededForTradeAsLong(fundsNeededForTrade.value);
|
||||
trade.getMaker().setPubKeyRing(trade.getOffer().getPubKeyRing());
|
||||
trade.getTaker().setPubKeyRing(model.getPubKeyRing());
|
||||
trade.getTaker().setPaymentAccountId(paymentAccountId);
|
||||
trade.getSelf().setPubKeyRing(model.getPubKeyRing());
|
||||
trade.getSelf().setPaymentAccountId(paymentAccountId);
|
||||
|
||||
TradeProtocol tradeProtocol = TradeProtocolFactory.getNewTradeProtocol(trade);
|
||||
TradeProtocol prev = tradeProtocolByTradeId.put(trade.getUid(), tradeProtocol);
|
||||
|
|
|
@ -1,92 +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 bisq.core.trade.messages;
|
||||
|
||||
import bisq.core.account.sign.SignedWitness;
|
||||
|
||||
import bisq.network.p2p.NodeAddress;
|
||||
|
||||
import bisq.common.app.Version;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
|
||||
/**
|
||||
* Not used anymore since v1.4.0
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("ALL")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Value
|
||||
public class TraderSignedWitnessMessage extends TradeMailboxMessage {
|
||||
private final NodeAddress senderNodeAddress;
|
||||
private final SignedWitness signedWitness;
|
||||
|
||||
public TraderSignedWitnessMessage(String uid,
|
||||
String tradeId,
|
||||
NodeAddress senderNodeAddress,
|
||||
SignedWitness signedWitness) {
|
||||
this(Version.getP2PMessageVersion(),
|
||||
uid,
|
||||
tradeId,
|
||||
senderNodeAddress,
|
||||
signedWitness);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PROTO BUFFER
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private TraderSignedWitnessMessage(String messageVersion,
|
||||
String uid,
|
||||
String tradeId,
|
||||
NodeAddress senderNodeAddress,
|
||||
SignedWitness signedWitness) {
|
||||
super(messageVersion, tradeId, uid);
|
||||
this.senderNodeAddress = senderNodeAddress;
|
||||
this.signedWitness = signedWitness;
|
||||
}
|
||||
|
||||
@Override
|
||||
public protobuf.NetworkEnvelope toProtoNetworkEnvelope() {
|
||||
final protobuf.TraderSignedWitnessMessage.Builder builder = protobuf.TraderSignedWitnessMessage.newBuilder();
|
||||
builder.setUid(uid)
|
||||
.setTradeId(tradeId)
|
||||
.setSenderNodeAddress(senderNodeAddress.toProtoMessage())
|
||||
.setSignedWitness(signedWitness.toProtoSignedWitness());
|
||||
return getNetworkEnvelopeBuilder().setTraderSignedWitnessMessage(builder).build();
|
||||
}
|
||||
|
||||
public static TraderSignedWitnessMessage fromProto(protobuf.TraderSignedWitnessMessage proto, String messageVersion) {
|
||||
return new TraderSignedWitnessMessage(messageVersion,
|
||||
proto.getUid(),
|
||||
proto.getTradeId(),
|
||||
NodeAddress.fromProto(proto.getSenderNodeAddress()),
|
||||
SignedWitness.fromProto(proto.getSignedWitness()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TraderSignedWitnessMessage{" +
|
||||
"\n senderNodeAddress=" + senderNodeAddress +
|
||||
"\n signedWitness=" + signedWitness +
|
||||
"\n} " + super.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -306,12 +306,8 @@ public class ProcessModel implements Model, PersistablePayload {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
public PaymentAccountPayload getPaymentAccountPayload(Trade trade) {
|
||||
PaymentAccount paymentAccount;
|
||||
if (trade instanceof MakerTrade)
|
||||
paymentAccount = getUser().getPaymentAccount(offer.getMakerPaymentAccountId());
|
||||
else
|
||||
paymentAccount = getUser().getPaymentAccount(trade.getTaker().getPaymentAccountId());
|
||||
public PaymentAccountPayload getPaymentAccountPayload(String paymentAccountId) {
|
||||
PaymentAccount paymentAccount = getUser().getPaymentAccount(paymentAccountId);
|
||||
return paymentAccount != null ? paymentAccount.getPaymentAccountPayload() : null;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class MaybeSendSignContractRequest extends TradeTask {
|
|||
trade.getSelf().setDepositTxHash(depositTx.getHash());
|
||||
trade.getSelf().setReserveTxKeyImages(reservedKeyImages);
|
||||
trade.getSelf().setPayoutAddressString(trade.getXmrWalletService().getAddressEntry(processModel.getOffer().getId(), XmrAddressEntry.Context.TRADE_PAYOUT).get().getAddressString()); // TODO (woodser): allow custom payout address?
|
||||
trade.getSelf().setPaymentAccountPayload(trade.getProcessModel().getPaymentAccountPayload(trade));
|
||||
trade.getSelf().setPaymentAccountPayload(trade.getProcessModel().getPaymentAccountPayload(trade.getSelf().getPaymentAccountId()));
|
||||
|
||||
// maker signs deposit hash nonce to avoid challenge protocol
|
||||
byte[] sig = null;
|
||||
|
|
|
@ -62,7 +62,6 @@ public class OfferMaker {
|
|||
0L,
|
||||
0L,
|
||||
0L,
|
||||
0L,
|
||||
false,
|
||||
false,
|
||||
0L,
|
||||
|
|
|
@ -204,7 +204,7 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
|||
CurrencyListItem selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
|
||||
if (selectedItem != null) {
|
||||
model.onSetTradeCurrency(selectedItem.tradeCurrency);
|
||||
updateChartData();
|
||||
UserThread.execute(() -> updateChartData());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -290,7 +290,7 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
|||
}
|
||||
|
||||
private void createListener() {
|
||||
changeListener = c -> updateChartData();
|
||||
changeListener = c -> UserThread.execute(() -> updateChartData());
|
||||
|
||||
currencyListItemsListener = c -> {
|
||||
if (model.getSelectedCurrencyListItem().isPresent())
|
||||
|
@ -353,17 +353,15 @@ public class OfferBookChartView extends ActivatableViewAndModel<VBox, OfferBookC
|
|||
chartPane.getChildren().add(areaChart);
|
||||
}
|
||||
|
||||
private void updateChartData() {
|
||||
UserThread.execute(() -> {
|
||||
seriesBuy.getData().clear();
|
||||
seriesSell.getData().clear();
|
||||
areaChart.getData().clear();
|
||||
private synchronized void updateChartData() {
|
||||
seriesBuy.getData().clear();
|
||||
seriesSell.getData().clear();
|
||||
areaChart.getData().clear();
|
||||
|
||||
seriesBuy.getData().addAll(filterOutliersBuy(model.getBuyData()));
|
||||
seriesSell.getData().addAll(filterOutliersSell(model.getSellData()));
|
||||
seriesBuy.getData().addAll(filterOutliersBuy(model.getBuyData()));
|
||||
seriesSell.getData().addAll(filterOutliersSell(model.getSellData()));
|
||||
|
||||
areaChart.getData().addAll(List.of(seriesBuy, seriesSell));
|
||||
});
|
||||
areaChart.getData().addAll(List.of(seriesBuy, seriesSell));
|
||||
}
|
||||
|
||||
List<XYChart.Data<Number, Number>> filterOutliersBuy(List<XYChart.Data<Number, Number>> buy) {
|
||||
|
|
|
@ -223,11 +223,6 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
|
|||
formatter.formatCoinWithCode(offer.getSellerSecurityDeposit());
|
||||
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit);
|
||||
|
||||
String txFee = Res.get("shared.makerTxFee", formatter.formatCoinWithCode(offer.getTxFee())) +
|
||||
" / " +
|
||||
Res.get("shared.takerTxFee", formatter.formatCoinWithCode(trade.getTxFee().multiply(3)));
|
||||
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("tradeDetailsWindow.txFee"), txFee);
|
||||
|
||||
NodeAddress arbitratorNodeAddress = trade.getArbitratorNodeAddress();
|
||||
if (arbitratorNodeAddress != null) {
|
||||
addConfirmationLabelTextField(gridPane, ++rowIndex,
|
||||
|
|
|
@ -127,7 +127,7 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
|
|||
TableView<ClosedTradesListItem> tableView;
|
||||
@FXML
|
||||
TableColumn<ClosedTradesListItem, ClosedTradesListItem> priceColumn, deviationColumn, amountColumn, volumeColumn,
|
||||
txFeeColumn, tradeFeeColumn, buyerSecurityDepositColumn, sellerSecurityDepositColumn,
|
||||
tradeFeeColumn, buyerSecurityDepositColumn, sellerSecurityDepositColumn,
|
||||
marketColumn, directionColumn, dateColumn, tradeIdColumn, stateColumn,
|
||||
duplicateColumn, avatarColumn;
|
||||
@FXML
|
||||
|
@ -171,7 +171,6 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
|
|||
@Override
|
||||
public void initialize() {
|
||||
widthListener = (observable, oldValue, newValue) -> onWidthChange((double) newValue);
|
||||
txFeeColumn.setGraphic(new AutoTooltipLabel(ColumnNames.TX_FEE.toString()));
|
||||
tradeFeeColumn.setGraphic(new AutoTooltipLabel(ColumnNames.TRADE_FEE_BTC.toString().replace(" BTC", "")));
|
||||
buyerSecurityDepositColumn.setGraphic(new AutoTooltipLabel(ColumnNames.BUYER_SEC.toString()));
|
||||
sellerSecurityDepositColumn.setGraphic(new AutoTooltipLabel(ColumnNames.SELLER_SEC.toString()));
|
||||
|
@ -194,7 +193,6 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
|
|||
setTradeIdColumnCellFactory();
|
||||
setDirectionColumnCellFactory();
|
||||
setAmountColumnCellFactory();
|
||||
setTxFeeColumnCellFactory();
|
||||
setTradeFeeColumnCellFactory();
|
||||
setBuyerSecurityDepositColumnCellFactory();
|
||||
setSellerSecurityDepositColumnCellFactory();
|
||||
|
@ -218,10 +216,6 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
|
|||
volumeColumn.setComparator(nullsFirstComparingAsTrade(Trade::getVolume));
|
||||
amountColumn.setComparator(Comparator.comparing(ClosedTradesListItem::getAmount, Comparator.nullsFirst(Comparator.naturalOrder())));
|
||||
avatarColumn.setComparator(Comparator.comparing(ClosedTradesListItem::getNumPastTrades, Comparator.nullsFirst(Comparator.naturalOrder())));
|
||||
txFeeColumn.setComparator(nullsFirstComparing(o ->
|
||||
o.getTradable() instanceof Trade ? ((Trade) o.getTradable()).getTxFee() : o.getTradable().getOffer().getTxFee()
|
||||
));
|
||||
txFeeColumn.setComparator(Comparator.comparing(ClosedTradesListItem::getTxFeeAsString, Comparator.nullsFirst(Comparator.naturalOrder())));
|
||||
|
||||
//
|
||||
tradeFeeColumn.setComparator(Comparator.comparing(item -> {
|
||||
|
@ -342,8 +336,6 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
|
|||
}
|
||||
|
||||
private void onWidthChange(double width) {
|
||||
txFeeColumn.setVisible(width > 1200);
|
||||
tradeFeeColumn.setVisible(width > 1300);
|
||||
buyerSecurityDepositColumn.setVisible(width > 1400);
|
||||
sellerSecurityDepositColumn.setVisible(width > 1500);
|
||||
}
|
||||
|
@ -632,28 +624,6 @@ public class ClosedTradesView extends ActivatableViewAndModel<VBox, ClosedTrades
|
|||
});
|
||||
}
|
||||
|
||||
private void setTxFeeColumnCellFactory() {
|
||||
txFeeColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||
txFeeColumn.setCellFactory(
|
||||
new Callback<>() {
|
||||
@Override
|
||||
public TableCell<ClosedTradesListItem, ClosedTradesListItem> call(
|
||||
TableColumn<ClosedTradesListItem, ClosedTradesListItem> column) {
|
||||
return new TableCell<>() {
|
||||
@Override
|
||||
public void updateItem(final ClosedTradesListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (item != null && !empty) {
|
||||
setGraphic(new AutoTooltipLabel(item.getTxFeeAsString()));
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setTradeFeeColumnCellFactory() {
|
||||
tradeFeeColumn.setCellValueFactory((item) -> new ReadOnlyObjectWrapper<>(item.getValue()));
|
||||
tradeFeeColumn.setCellFactory(
|
||||
|
|
|
@ -204,7 +204,6 @@ class EditOfferDataModel extends MutableOfferDataModel {
|
|||
newOfferPayload.getAcceptedBankIds(),
|
||||
offerPayload.getVersionNr(),
|
||||
offerPayload.getBlockHeightAtOfferCreation(),
|
||||
offerPayload.getTxFee(),
|
||||
offerPayload.getMakerFee(),
|
||||
offerPayload.getBuyerSecurityDeposit(),
|
||||
offerPayload.getSellerSecurityDeposit(),
|
||||
|
|
|
@ -294,26 +294,6 @@ public class PendingTradesDataModel extends ActivatableDataModel {
|
|||
}
|
||||
}
|
||||
|
||||
Coin getTxFee() {
|
||||
Trade trade = getTrade();
|
||||
if (trade != null) {
|
||||
if (isMaker()) {
|
||||
Offer offer = trade.getOffer();
|
||||
if (offer != null) {
|
||||
return offer.getTxFee();
|
||||
} else {
|
||||
log.error("offer is null");
|
||||
return Coin.ZERO;
|
||||
}
|
||||
} else {
|
||||
return trade.getTxFee().multiply(3);
|
||||
}
|
||||
} else {
|
||||
log.error("Trade is null at getTotalFees");
|
||||
return Coin.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PaymentAccountPayload getSellersPaymentAccountPayload() {
|
||||
if (getTrade() == null) return null;
|
||||
|
|
|
@ -292,18 +292,6 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
|||
: "";
|
||||
}
|
||||
|
||||
public String getTxFee() {
|
||||
if (trade != null && trade.getAmount() != null) {
|
||||
Coin txFee = dataModel.getTxFee();
|
||||
String percentage = GUIUtil.getPercentageOfTradeAmount(txFee,
|
||||
trade.getAmount(),
|
||||
Coin.ZERO);
|
||||
return btcFormatter.formatCoinWithCode(txFee) + percentage;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String getTradeFee() {
|
||||
if (trade != null && dataModel.getOffer() != null && trade.getAmount() != null) {
|
||||
checkNotNull(dataModel.getTrade());
|
||||
|
|
|
@ -108,10 +108,6 @@ public class BuyerStep4View extends TradeStepView {
|
|||
addCompactTopLabelTextField(gridPane, ++gridRow, getFiatTradeAmountLabel(), model.getFiatVolume());
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.refunded"), model.getSecurityDeposit());
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, Res.get("portfolio.pending.step5_buyer.tradeFee"), model.getTradeFee());
|
||||
final String miningFee = model.dataModel.isMaker() ?
|
||||
Res.get("portfolio.pending.step5_buyer.makersMiningFee") :
|
||||
Res.get("portfolio.pending.step5_buyer.takersMiningFee");
|
||||
addCompactTopLabelTextField(gridPane, ++gridRow, miningFee, model.getTxFee());
|
||||
}
|
||||
|
||||
closeButton = new AutoTooltipButton(Res.get("shared.close"));
|
||||
|
|
|
@ -89,7 +89,6 @@ public class TradesChartsViewModelTest {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
|
|
|
@ -624,7 +624,6 @@ public class OfferBookViewModelTest {
|
|||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
|
|
|
@ -98,7 +98,6 @@ public class OfferMaker {
|
|||
null,
|
||||
"2",
|
||||
lookup.valueOf(blockHeight, 700000L),
|
||||
lookup.valueOf(txFee, 250L),
|
||||
lookup.valueOf(makerFee, 1000L),
|
||||
lookup.valueOf(buyerSecurityDeposit, 10000L),
|
||||
lookup.valueOf(sellerSecurityDeposit, 10000L),
|
||||
|
|
|
@ -826,35 +826,34 @@ message TradeInfo {
|
|||
string short_id = 3;
|
||||
uint64 date = 4;
|
||||
string role = 5;
|
||||
uint64 tx_fee_as_long = 7;
|
||||
uint64 taker_fee_as_long = 8;
|
||||
string taker_fee_tx_id = 9;
|
||||
string payout_tx_id = 10;
|
||||
uint64 amount_as_long = 11;
|
||||
uint64 buyer_security_deposit = 12;
|
||||
uint64 seller_security_deposit = 13;
|
||||
string price = 14;
|
||||
string arbitrator_node_address = 15;
|
||||
string trade_peer_node_address = 16;
|
||||
string state = 17;
|
||||
string phase = 18;
|
||||
string period_state = 19;
|
||||
string payout_state = 20;
|
||||
string dispute_state = 21;
|
||||
bool is_deposits_published = 22;
|
||||
bool is_deposits_confirmed = 23;
|
||||
bool is_deposits_unlocked = 24;
|
||||
bool is_payment_sent = 25;
|
||||
bool is_payment_received = 26;
|
||||
bool is_payout_published = 27;
|
||||
bool is_payout_confirmed = 28;
|
||||
bool is_payout_unlocked = 29;
|
||||
bool is_completed = 30;
|
||||
string contract_as_json = 31;
|
||||
ContractInfo contract = 32;
|
||||
string trade_volume = 33;
|
||||
string maker_deposit_tx_id = 34;
|
||||
string taker_deposit_tx_id = 35;
|
||||
uint64 taker_fee_as_long = 6;
|
||||
string taker_fee_tx_id = 7;
|
||||
string payout_tx_id = 8;
|
||||
uint64 amount_as_long = 9;
|
||||
uint64 buyer_security_deposit = 10;
|
||||
uint64 seller_security_deposit = 11;
|
||||
string price = 12;
|
||||
string arbitrator_node_address = 13;
|
||||
string trade_peer_node_address = 14;
|
||||
string state = 15;
|
||||
string phase = 16;
|
||||
string period_state = 17;
|
||||
string payout_state = 18;
|
||||
string dispute_state = 19;
|
||||
bool is_deposits_published = 20;
|
||||
bool is_deposits_confirmed = 21;
|
||||
bool is_deposits_unlocked = 22;
|
||||
bool is_payment_sent = 23;
|
||||
bool is_payment_received = 24;
|
||||
bool is_payout_published = 25;
|
||||
bool is_payout_confirmed = 26;
|
||||
bool is_payout_unlocked = 27;
|
||||
bool is_completed = 28;
|
||||
string contract_as_json = 29;
|
||||
ContractInfo contract = 30;
|
||||
string trade_volume = 31;
|
||||
string maker_deposit_tx_id = 32;
|
||||
string taker_deposit_tx_id = 33;
|
||||
}
|
||||
|
||||
message ContractInfo {
|
||||
|
|
|
@ -59,7 +59,6 @@ message NetworkEnvelope {
|
|||
PeerPublishedDelayedPayoutTxMessage peer_published_delayed_payout_tx_message = 32;
|
||||
|
||||
RefreshTradeStateRequest refresh_trade_state_request = 33 [deprecated = true];
|
||||
TraderSignedWitnessMessage trader_signed_witness_message = 34 [deprecated = true];
|
||||
|
||||
GetInventoryRequest get_inventory_request = 35;
|
||||
GetInventoryResponse get_inventory_response = 36;
|
||||
|
@ -435,14 +434,6 @@ message RefreshTradeStateRequest {
|
|||
NodeAddress sender_node_address = 3 [deprecated = true];
|
||||
}
|
||||
|
||||
// Deprecated since 1.4.0
|
||||
message TraderSignedWitnessMessage {
|
||||
string uid = 1 [deprecated = true];
|
||||
string trade_id = 2 [deprecated = true];
|
||||
NodeAddress sender_node_address = 3 [deprecated = true];
|
||||
SignedWitness signed_witness = 4 [deprecated = true];
|
||||
}
|
||||
|
||||
message ChatMessage {
|
||||
int64 date = 1;
|
||||
string trade_id = 2;
|
||||
|
@ -762,20 +753,19 @@ message OfferPayload {
|
|||
repeated string accepted_bank_ids = 19;
|
||||
string version_nr = 20;
|
||||
int64 block_height_at_offer_creation = 21;
|
||||
int64 tx_fee = 22;
|
||||
int64 maker_fee = 23;
|
||||
int64 buyer_security_deposit = 24;
|
||||
int64 seller_security_deposit = 25;
|
||||
int64 max_trade_limit = 26;
|
||||
int64 max_trade_period = 27;
|
||||
bool use_auto_close = 28;
|
||||
bool use_re_open_after_auto_close = 29;
|
||||
int64 lower_close_price = 30;
|
||||
int64 upper_close_price = 31;
|
||||
bool is_private_offer = 32;
|
||||
string hash_of_challenge = 33;
|
||||
map<string, string> extra_data = 34;
|
||||
int32 protocol_version = 35;
|
||||
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;
|
||||
|
||||
NodeAddress arbitrator_signer = 1001;
|
||||
string arbitrator_signature = 1002;
|
||||
|
@ -1634,7 +1624,6 @@ message Trade {
|
|||
string payout_tx_hex = 4;
|
||||
string payout_tx_key = 5;
|
||||
int64 amount_as_long = 6;
|
||||
int64 tx_fee_as_long = 7;
|
||||
int64 taker_fee_as_long = 8;
|
||||
int64 take_offer_date = 9;
|
||||
int64 price = 10;
|
||||
|
|
Loading…
Reference in a new issue