mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-11 16:54:39 -05:00
fix trade is in an invalid state warning
Co-authored-by: duriancrepe <duriancrepe@protonmail.com>
This commit is contained in:
parent
14c5384edc
commit
e79450f65e
@ -3,5 +3,4 @@
|
||||
# Haveno Config options not configurable in test harness-specific apitest.properties
|
||||
# file. This is where you might define Haveno options such as:
|
||||
# dumpBlockchainData=true
|
||||
# dumpDelayedPayoutTxs=true
|
||||
# dumpStatistics=true
|
||||
|
@ -107,8 +107,6 @@ public class Config {
|
||||
public static final String USE_ALL_PROVIDED_NODES = "useAllProvidedNodes";
|
||||
public static final String USER_AGENT = "userAgent";
|
||||
public static final String NUM_CONNECTIONS_FOR_BTC = "numConnectionsForBtc";
|
||||
public static final String DUMP_DELAYED_PAYOUT_TXS = "dumpDelayedPayoutTxs";
|
||||
public static final String ALLOW_FAULTY_DELAYED_TXS = "allowFaultyDelayedTxs";
|
||||
public static final String API_PASSWORD = "apiPassword";
|
||||
public static final String API_PORT = "apiPort";
|
||||
public static final String PREVENT_PERIODIC_SHUTDOWN_AT_SEED_NODE = "preventPeriodicShutdownAtSeedNode";
|
||||
@ -192,8 +190,6 @@ public class Config {
|
||||
public final boolean useAllProvidedNodes;
|
||||
public final String userAgent;
|
||||
public final int numConnectionsForBtc;
|
||||
public final boolean dumpDelayedPayoutTxs;
|
||||
public final boolean allowFaultyDelayedTxs;
|
||||
public final String apiPassword;
|
||||
public final int apiPort;
|
||||
public final boolean preventPeriodicShutdownAtSeedNode;
|
||||
@ -559,19 +555,6 @@ public class Config {
|
||||
.ofType(int.class)
|
||||
.defaultsTo(DEFAULT_NUM_CONNECTIONS_FOR_BTC);
|
||||
|
||||
ArgumentAcceptingOptionSpec<Boolean> dumpDelayedPayoutTxsOpt =
|
||||
parser.accepts(DUMP_DELAYED_PAYOUT_TXS, "Dump delayed payout transactions to file")
|
||||
.withRequiredArg()
|
||||
.ofType(boolean.class)
|
||||
.defaultsTo(false);
|
||||
|
||||
ArgumentAcceptingOptionSpec<Boolean> allowFaultyDelayedTxsOpt =
|
||||
parser.accepts(ALLOW_FAULTY_DELAYED_TXS, "Allow completion of trades with faulty delayed " +
|
||||
"payout transactions")
|
||||
.withRequiredArg()
|
||||
.ofType(boolean.class)
|
||||
.defaultsTo(false);
|
||||
|
||||
ArgumentAcceptingOptionSpec<String> apiPasswordOpt =
|
||||
parser.accepts(API_PASSWORD, "gRPC API password")
|
||||
.withRequiredArg()
|
||||
@ -714,8 +697,6 @@ public class Config {
|
||||
this.userAgent = options.valueOf(userAgentOpt);
|
||||
this.numConnectionsForBtc = options.valueOf(numConnectionsForBtcOpt);
|
||||
|
||||
this.dumpDelayedPayoutTxs = options.valueOf(dumpDelayedPayoutTxsOpt);
|
||||
this.allowFaultyDelayedTxs = options.valueOf(allowFaultyDelayedTxsOpt);
|
||||
this.apiPassword = options.valueOf(apiPasswordOpt);
|
||||
this.apiPort = options.valueOf(apiPortOpt);
|
||||
this.preventPeriodicShutdownAtSeedNode = options.valueOf(preventPeriodicShutdownAtSeedNodeOpt);
|
||||
|
@ -68,7 +68,6 @@ public class TradeInfo implements Payload {
|
||||
private final String role;
|
||||
private final long txFeeAsLong;
|
||||
private final long takerFeeAsLong;
|
||||
private final String takerFeeTxId;
|
||||
private final String makerDepositTxId;
|
||||
private final String takerDepositTxId;
|
||||
private final String payoutTxId;
|
||||
@ -97,7 +96,6 @@ public class TradeInfo implements Payload {
|
||||
this.role = builder.getRole();
|
||||
this.txFeeAsLong = builder.getTxFeeAsLong();
|
||||
this.takerFeeAsLong = builder.getTakerFeeAsLong();
|
||||
this.takerFeeTxId = builder.getTakerFeeTxId();
|
||||
this.makerDepositTxId = builder.getMakerDepositTxId();
|
||||
this.takerDepositTxId = builder.getTakerDepositTxId();
|
||||
this.payoutTxId = builder.getPayoutTxId();
|
||||
@ -149,7 +147,6 @@ public class TradeInfo implements Payload {
|
||||
.withRole(role == null ? "" : role)
|
||||
.withTxFeeAsLong(trade.getTxFeeAsLong())
|
||||
.withTakerFeeAsLong(trade.getTakerFeeAsLong())
|
||||
.withTakerFeeTxId(trade.getTakerFeeTxId())
|
||||
.withMakerDepositTxId(trade.getMaker().getDepositTxHash())
|
||||
.withTakerDepositTxId(trade.getTaker().getDepositTxHash())
|
||||
.withPayoutTxId(trade.getPayoutTxId())
|
||||
@ -187,7 +184,6 @@ public class TradeInfo implements Payload {
|
||||
.setRole(role)
|
||||
.setTxFeeAsLong(txFeeAsLong)
|
||||
.setTakerFeeAsLong(takerFeeAsLong)
|
||||
.setTakerFeeTxId(takerFeeTxId == null ? "" : takerFeeTxId)
|
||||
.setMakerDepositTxId(makerDepositTxId == null ? "" : makerDepositTxId)
|
||||
.setTakerDepositTxId(takerDepositTxId == null ? "" : takerDepositTxId)
|
||||
.setPayoutTxId(payoutTxId == null ? "" : payoutTxId)
|
||||
@ -219,7 +215,6 @@ public class TradeInfo implements Payload {
|
||||
.withRole(proto.getRole())
|
||||
.withTxFeeAsLong(proto.getTxFeeAsLong())
|
||||
.withTakerFeeAsLong(proto.getTakerFeeAsLong())
|
||||
.withTakerFeeTxId(proto.getTakerFeeTxId())
|
||||
.withMakerDepositTxId(proto.getMakerDepositTxId())
|
||||
.withTakerDepositTxId(proto.getTakerDepositTxId())
|
||||
.withPayoutTxId(proto.getPayoutTxId())
|
||||
@ -251,7 +246,6 @@ public class TradeInfo implements Payload {
|
||||
", role='" + role + '\'' + "\n" +
|
||||
", txFeeAsLong='" + txFeeAsLong + '\'' + "\n" +
|
||||
", takerFeeAsLong='" + takerFeeAsLong + '\'' + "\n" +
|
||||
", takerFeeTxId='" + takerFeeTxId + '\'' + "\n" +
|
||||
", makerDepositTxId='" + makerDepositTxId + '\'' + "\n" +
|
||||
", takerDepositTxId='" + takerDepositTxId + '\'' + "\n" +
|
||||
", payoutTxId='" + payoutTxId + '\'' + "\n" +
|
||||
|
@ -40,7 +40,6 @@ public final class TradeInfoV1Builder {
|
||||
private boolean isCurrencyForTakerFeeBtc;
|
||||
private long txFeeAsLong;
|
||||
private long takerFeeAsLong;
|
||||
private String takerFeeTxId;
|
||||
private String makerDepositTxId;
|
||||
private String takerDepositTxId;
|
||||
private String payoutTxId;
|
||||
@ -102,11 +101,6 @@ public final class TradeInfoV1Builder {
|
||||
return this;
|
||||
}
|
||||
|
||||
public TradeInfoV1Builder withTakerFeeTxId(String takerFeeTxId) {
|
||||
this.takerFeeTxId = takerFeeTxId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TradeInfoV1Builder withMakerDepositTxId(String makerDepositTxId) {
|
||||
this.makerDepositTxId = makerDepositTxId;
|
||||
return this;
|
||||
|
@ -255,7 +255,7 @@ public class WalletAppSetup {
|
||||
if (txId.equals(trade.getTaker().getDepositTxHash())) {
|
||||
details = Res.get("popup.warning.trade.txRejected.deposit");
|
||||
}
|
||||
if (txId.equals(trade.getOffer().getOfferFeePaymentTxId()) || txId.equals(trade.getTakerFeeTxId())) {
|
||||
if (txId.equals(trade.getOffer().getOfferFeePaymentTxId())) {
|
||||
details = Res.get("popup.warning.trade.txRejected.tradeFee");
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,6 @@ public class ClosedTradableManager implements PersistedDataHost {
|
||||
private final TradeStatisticsManager tradeStatisticsManager;
|
||||
private final PersistenceManager<TradableList<Tradable>> persistenceManager;
|
||||
private final CleanupMailboxMessagesService cleanupMailboxMessagesService;
|
||||
private final DumpDelayedPayoutTx dumpDelayedPayoutTx;
|
||||
|
||||
private final TradableList<Tradable> closedTradables = new TradableList<>();
|
||||
|
||||
@ -81,14 +80,12 @@ public class ClosedTradableManager implements PersistedDataHost {
|
||||
Preferences preferences,
|
||||
TradeStatisticsManager tradeStatisticsManager,
|
||||
PersistenceManager<TradableList<Tradable>> persistenceManager,
|
||||
CleanupMailboxMessagesService cleanupMailboxMessagesService,
|
||||
DumpDelayedPayoutTx dumpDelayedPayoutTx) {
|
||||
CleanupMailboxMessagesService cleanupMailboxMessagesService) {
|
||||
this.keyRing = keyRing;
|
||||
this.priceFeedService = priceFeedService;
|
||||
this.preferences = preferences;
|
||||
this.tradeStatisticsManager = tradeStatisticsManager;
|
||||
this.cleanupMailboxMessagesService = cleanupMailboxMessagesService;
|
||||
this.dumpDelayedPayoutTx = dumpDelayedPayoutTx;
|
||||
this.persistenceManager = persistenceManager;
|
||||
|
||||
this.persistenceManager.initialize(closedTradables, "ClosedTrades", PersistenceManager.Source.PRIVATE);
|
||||
@ -101,7 +98,6 @@ public class ClosedTradableManager implements PersistedDataHost {
|
||||
closedTradables.stream()
|
||||
.filter(tradable -> tradable.getOffer() != null)
|
||||
.forEach(tradable -> tradable.getOffer().setPriceFeedService(priceFeedService));
|
||||
dumpDelayedPayoutTx.maybeDumpDelayedPayoutTxs(closedTradables, "delayed_payout_txs_closed");
|
||||
completeHandler.run();
|
||||
},
|
||||
completeHandler);
|
||||
|
@ -1,64 +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;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
import bisq.common.file.JsonFileManager;
|
||||
import bisq.common.util.Utilities;
|
||||
import bisq.core.util.JsonUtil;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DumpDelayedPayoutTx {
|
||||
private final boolean dumpDelayedPayoutTxs;
|
||||
private final JsonFileManager jsonFileManager;
|
||||
|
||||
@Inject
|
||||
DumpDelayedPayoutTx(@Named(Config.STORAGE_DIR) File storageDir,
|
||||
@Named(Config.DUMP_DELAYED_PAYOUT_TXS) boolean dumpDelayedPayoutTxs) {
|
||||
this.dumpDelayedPayoutTxs = dumpDelayedPayoutTxs;
|
||||
jsonFileManager = new JsonFileManager(storageDir);
|
||||
}
|
||||
|
||||
static class DelayedPayoutHash {
|
||||
final String tradeId;
|
||||
final String delayedPayoutTx;
|
||||
|
||||
DelayedPayoutHash(String tradeId, String delayedPayoutTx) {
|
||||
this.tradeId = tradeId;
|
||||
this.delayedPayoutTx = delayedPayoutTx;
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Tradable> void maybeDumpDelayedPayoutTxs(TradableList<T> tradableList, String fileName) {
|
||||
if (!dumpDelayedPayoutTxs)
|
||||
return;
|
||||
|
||||
var delayedPayoutHashes = tradableList.stream()
|
||||
.filter(tradable -> tradable instanceof Trade)
|
||||
.map(trade -> new DelayedPayoutHash(trade.getId(),
|
||||
Utilities.bytesAsHexString(((Trade) trade).getDelayedPayoutTxBytes())))
|
||||
.collect(Collectors.toList());
|
||||
jsonFileManager.writeToDiscThreaded(JsonUtil.objectToJson(delayedPayoutHashes), fileName);
|
||||
}
|
||||
|
||||
}
|
@ -310,10 +310,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
@Nullable
|
||||
@Getter
|
||||
@Setter
|
||||
private String takerFeeTxId;
|
||||
@Nullable
|
||||
@Getter
|
||||
@Setter
|
||||
private long amountAsLong;
|
||||
@Setter
|
||||
private long price;
|
||||
@ -366,8 +362,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
|
||||
// Added in v1.2.0
|
||||
@Nullable
|
||||
transient private Transaction delayedPayoutTx;
|
||||
@Nullable
|
||||
transient private Coin tradeAmount;
|
||||
|
||||
transient private ObjectProperty<Coin> tradeAmountProperty;
|
||||
@ -383,10 +377,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
@Getter
|
||||
@Setter
|
||||
private long lockTime;
|
||||
@Nullable
|
||||
@Getter
|
||||
@Setter
|
||||
private byte[] delayedPayoutTxBytes;
|
||||
@Getter
|
||||
@Nullable
|
||||
private RefundResultState refundResultState = RefundResultState.UNDEFINED_REFUND_RESULT;
|
||||
@ -548,7 +538,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
.setLockTime(lockTime)
|
||||
.setUid(uid);
|
||||
|
||||
Optional.ofNullable(takerFeeTxId).ifPresent(builder::setTakerFeeTxId);
|
||||
Optional.ofNullable(payoutTxId).ifPresent(builder::setPayoutTxId);
|
||||
Optional.ofNullable(contract).ifPresent(e -> builder.setContract(contract.toProtoMessage()));
|
||||
Optional.ofNullable(contractAsJson).ifPresent(builder::setContractAsJson);
|
||||
@ -559,7 +548,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
Optional.ofNullable(refundResultState).ifPresent(e -> builder.setRefundResultState(RefundResultState.toProtoMessage(refundResultState)));
|
||||
Optional.ofNullable(payoutTxHex).ifPresent(e -> builder.setPayoutTxHex(payoutTxHex));
|
||||
Optional.ofNullable(payoutTxKey).ifPresent(e -> builder.setPayoutTxHex(payoutTxKey));
|
||||
Optional.ofNullable(delayedPayoutTxBytes).ifPresent(e -> builder.setDelayedPayoutTxBytes(ByteString.copyFrom(delayedPayoutTxBytes)));
|
||||
Optional.ofNullable(counterCurrencyExtraData).ifPresent(e -> builder.setCounterCurrencyExtraData(counterCurrencyExtraData));
|
||||
Optional.ofNullable(assetTxProofResult).ifPresent(e -> builder.setAssetTxProofResult(assetTxProofResult.name()));
|
||||
return builder.build();
|
||||
@ -570,7 +558,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
trade.setState(State.fromProto(proto.getState()));
|
||||
trade.setDisputeState(DisputeState.fromProto(proto.getDisputeState()));
|
||||
trade.setPeriodState(TradePeriodState.fromProto(proto.getPeriodState()));
|
||||
trade.setTakerFeeTxId(ProtoUtil.stringOrNullFromProto(proto.getTakerFeeTxId()));
|
||||
trade.setPayoutTxId(ProtoUtil.stringOrNullFromProto(proto.getPayoutTxId()));
|
||||
trade.setPayoutTxHex(ProtoUtil.stringOrNullFromProto(proto.getPayoutTxHex()));
|
||||
trade.setPayoutTxKey(ProtoUtil.stringOrNullFromProto(proto.getPayoutTxKey()));
|
||||
@ -581,7 +568,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
trade.setCounterCurrencyTxId(proto.getCounterCurrencyTxId().isEmpty() ? null : proto.getCounterCurrencyTxId());
|
||||
trade.setMediationResultState(MediationResultState.fromProto(proto.getMediationResultState()));
|
||||
trade.setRefundResultState(RefundResultState.fromProto(proto.getRefundResultState()));
|
||||
trade.setDelayedPayoutTxBytes(ProtoUtil.byteArrayOrNullFromProto(proto.getDelayedPayoutTxBytes()));
|
||||
trade.setLockTime(proto.getLockTime());
|
||||
trade.setCounterCurrencyExtraData(ProtoUtil.stringOrNullFromProto(proto.getCounterCurrencyExtraData()));
|
||||
|
||||
@ -963,15 +949,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
}
|
||||
}
|
||||
|
||||
public void applyDelayedPayoutTx(Transaction delayedPayoutTx) {
|
||||
this.delayedPayoutTx = delayedPayoutTx;
|
||||
this.delayedPayoutTxBytes = delayedPayoutTx.bitcoinSerialize();
|
||||
}
|
||||
|
||||
public void applyDelayedPayoutTxBytes(byte[] delayedPayoutTxBytes) {
|
||||
this.delayedPayoutTxBytes = delayedPayoutTxBytes;
|
||||
}
|
||||
|
||||
public void addAndPersistChatMessage(ChatMessage chatMessage) {
|
||||
if (!chatMessages.contains(chatMessage)) {
|
||||
chatMessages.add(chatMessage);
|
||||
@ -1438,10 +1415,8 @@ public abstract class Trade implements Tradable, Model {
|
||||
|
||||
public boolean isTxChainInvalid() {
|
||||
return offer.getOfferFeePaymentTxId() == null ||
|
||||
getTakerFeeTxId() == null ||
|
||||
processModel.getMaker().getDepositTxHash() == null ||
|
||||
processModel.getMaker().getDepositTxHash() == null ||
|
||||
getDelayedPayoutTxBytes() == null;
|
||||
processModel.getTaker().getDepositTxHash() == null;
|
||||
}
|
||||
|
||||
|
||||
@ -1484,7 +1459,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
",\n takerFeeAsLong=" + takerFeeAsLong +
|
||||
",\n takeOfferDate=" + takeOfferDate +
|
||||
",\n processModel=" + processModel +
|
||||
",\n takerFeeTxId='" + takerFeeTxId + '\'' +
|
||||
",\n payoutTxId='" + payoutTxId + '\'' +
|
||||
",\n tradeAmountAsLong=" + amountAsLong +
|
||||
",\n tradePrice=" + price +
|
||||
@ -1507,7 +1481,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
",\n disputeStateProperty=" + disputeStateProperty +
|
||||
",\n tradePeriodStateProperty=" + tradePeriodStateProperty +
|
||||
",\n errorMessageProperty=" + errorMessageProperty +
|
||||
",\n delayedPayoutTx=" + delayedPayoutTx +
|
||||
",\n payoutTx=" + payoutTx +
|
||||
",\n tradeAmount=" + tradeAmount +
|
||||
",\n tradeAmountProperty=" + tradeAmountProperty +
|
||||
@ -1515,7 +1488,6 @@ public abstract class Trade implements Tradable, Model {
|
||||
",\n mediationResultState=" + mediationResultState +
|
||||
",\n mediationResultStateProperty=" + mediationResultStateProperty +
|
||||
",\n lockTime=" + lockTime +
|
||||
",\n delayedPayoutTxBytes=" + Utilities.bytesAsHexString(delayedPayoutTxBytes) +
|
||||
",\n refundResultState=" + refundResultState +
|
||||
",\n refundResultStateProperty=" + refundResultStateProperty +
|
||||
"\n}";
|
||||
|
@ -155,9 +155,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||
@Getter
|
||||
private final LongProperty numPendingTrades = new SimpleLongProperty();
|
||||
private final ReferralIdService referralIdService;
|
||||
private final DumpDelayedPayoutTx dumpDelayedPayoutTx;
|
||||
@Getter
|
||||
private final boolean allowFaultyDelayedTxs;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -183,9 +180,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||
ProcessModelServiceProvider processModelServiceProvider,
|
||||
ClockWatcher clockWatcher,
|
||||
PersistenceManager<TradableList<Trade>> persistenceManager,
|
||||
ReferralIdService referralIdService,
|
||||
DumpDelayedPayoutTx dumpDelayedPayoutTx,
|
||||
@Named(Config.ALLOW_FAULTY_DELAYED_TXS) boolean allowFaultyDelayedTxs) {
|
||||
ReferralIdService referralIdService) {
|
||||
this.user = user;
|
||||
this.keyRing = keyRing;
|
||||
this.xmrWalletService = xmrWalletService;
|
||||
@ -204,8 +199,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||
this.processModelServiceProvider = processModelServiceProvider;
|
||||
this.clockWatcher = clockWatcher;
|
||||
this.referralIdService = referralIdService;
|
||||
this.dumpDelayedPayoutTx = dumpDelayedPayoutTx;
|
||||
this.allowFaultyDelayedTxs = allowFaultyDelayedTxs;
|
||||
this.persistenceManager = persistenceManager;
|
||||
|
||||
this.persistenceManager.initialize(tradableList, "PendingTrades", PersistenceManager.Source.PRIVATE);
|
||||
@ -227,7 +220,6 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
||||
tradableList.stream()
|
||||
.filter(trade -> trade.getOffer() != null)
|
||||
.forEach(trade -> trade.getOffer().setPriceFeedService(priceFeedService));
|
||||
dumpDelayedPayoutTx.maybeDumpDelayedPayoutTxs(tradableList, "delayed_payout_txs_pending");
|
||||
completeHandler.run();
|
||||
},
|
||||
completeHandler);
|
||||
|
@ -29,8 +29,6 @@ import bisq.common.config.Config;
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import static bisq.common.config.Config.ALLOW_FAULTY_DELAYED_TXS;
|
||||
import static bisq.common.config.Config.DUMP_DELAYED_PAYOUT_TXS;
|
||||
import static bisq.common.config.Config.DUMP_STATISTICS;
|
||||
import static com.google.inject.name.Names.named;
|
||||
|
||||
@ -52,7 +50,5 @@ public class TradeModule extends AppModule {
|
||||
bind(ReferralIdService.class).in(Singleton.class);
|
||||
|
||||
bindConstant().annotatedWith(named(DUMP_STATISTICS)).to(config.dumpStatistics);
|
||||
bindConstant().annotatedWith(named(DUMP_DELAYED_PAYOUT_TXS)).to(config.dumpDelayedPayoutTxs);
|
||||
bindConstant().annotatedWith(named(ALLOW_FAULTY_DELAYED_TXS)).to(config.allowFaultyDelayedTxs);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import bisq.core.btc.wallet.XmrWalletService;
|
||||
import bisq.core.offer.Offer;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.trade.CleanupMailboxMessages;
|
||||
import bisq.core.trade.DumpDelayedPayoutTx;
|
||||
import bisq.core.trade.TradableList;
|
||||
import bisq.core.trade.Trade;
|
||||
import bisq.core.trade.TradeUtil;
|
||||
@ -52,7 +51,6 @@ public class FailedTradesManager implements PersistedDataHost {
|
||||
private final CleanupMailboxMessages cleanupMailboxMessages;
|
||||
private final PersistenceManager<TradableList<Trade>> persistenceManager;
|
||||
private final TradeUtil tradeUtil;
|
||||
private final DumpDelayedPayoutTx dumpDelayedPayoutTx;
|
||||
@Setter
|
||||
private Function<Trade, Boolean> unFailTradeCallback;
|
||||
|
||||
@ -62,13 +60,11 @@ public class FailedTradesManager implements PersistedDataHost {
|
||||
XmrWalletService xmrWalletService,
|
||||
PersistenceManager<TradableList<Trade>> persistenceManager,
|
||||
TradeUtil tradeUtil,
|
||||
CleanupMailboxMessages cleanupMailboxMessages,
|
||||
DumpDelayedPayoutTx dumpDelayedPayoutTx) {
|
||||
CleanupMailboxMessages cleanupMailboxMessages) {
|
||||
this.keyRing = keyRing;
|
||||
this.priceFeedService = priceFeedService;
|
||||
this.xmrWalletService = xmrWalletService;
|
||||
this.cleanupMailboxMessages = cleanupMailboxMessages;
|
||||
this.dumpDelayedPayoutTx = dumpDelayedPayoutTx;
|
||||
this.persistenceManager = persistenceManager;
|
||||
this.tradeUtil = tradeUtil;
|
||||
|
||||
@ -82,7 +78,6 @@ public class FailedTradesManager implements PersistedDataHost {
|
||||
failedTrades.stream()
|
||||
.filter(trade -> trade.getOffer() != null)
|
||||
.forEach(trade -> trade.getOffer().setPriceFeedService(priceFeedService));
|
||||
dumpDelayedPayoutTx.maybeDumpDelayedPayoutTxs(failedTrades, "delayed_payout_txs_failed");
|
||||
completeHandler.run();
|
||||
},
|
||||
completeHandler);
|
||||
|
@ -54,11 +54,9 @@ public class TakerReserveTradeFunds extends TradeTask {
|
||||
for (MoneroOutput input : reserveTx.getInputs()) reservedKeyImages.add(input.getKeyImage().getHex());
|
||||
|
||||
// save process state
|
||||
// TODO (woodser): persist
|
||||
processModel.setReserveTx(reserveTx);
|
||||
processModel.getTaker().setReserveTxKeyImages(reservedKeyImages);
|
||||
trade.setTakerFeeTxId(reserveTx.getHash()); // TODO (woodser): this should be multisig deposit tx id? how is it used?
|
||||
//trade.setState(Trade.State.TAKER_PUBLISHED_TAKER_FEE_TX); // TODO (woodser): fee tx is not broadcast separate, update states
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
trade.setErrorMessage("An error occurred.\n" +
|
||||
|
@ -60,14 +60,13 @@ class TransactionAwareTrade implements TransactionAwareTradable {
|
||||
public boolean isRelatedToTransaction(MoneroTxWallet transaction) {
|
||||
String txId = transaction.getHash();
|
||||
|
||||
boolean isTakerOfferFeeTx = txId.equals(trade.getTakerFeeTxId());
|
||||
boolean isOfferFeeTx = isOfferFeeTx(txId);
|
||||
boolean isMakerDepositTx = isMakerDepositTx(txId);
|
||||
boolean isTakerDepositTx = isTakerDepositTx(txId);
|
||||
boolean isPayoutTx = isPayoutTx(txId);
|
||||
boolean isDisputedPayoutTx = isDisputedPayoutTx(txId);
|
||||
|
||||
return isTakerOfferFeeTx || isOfferFeeTx || isMakerDepositTx || isTakerDepositTx ||
|
||||
return isOfferFeeTx || isMakerDepositTx || isTakerDepositTx ||
|
||||
isPayoutTx || isDisputedPayoutTx;
|
||||
}
|
||||
|
||||
|
@ -123,9 +123,7 @@ class TransactionsListItem {
|
||||
details = Res.get("funds.tx.createOfferFee", tradeId);
|
||||
} else if (tradable instanceof Trade) {
|
||||
Trade trade = (Trade) tradable;
|
||||
if (trade.getTakerFeeTxId() != null && trade.getTakerFeeTxId().equals(txId)) {
|
||||
details = Res.get("funds.tx.takeOfferFee", tradeId);
|
||||
} else {
|
||||
|
||||
Offer offer = trade.getOffer();
|
||||
String offerFeePaymentTxID = offer.getOfferFeePaymentTxId();
|
||||
if (offerFeePaymentTxID != null && offerFeePaymentTxID.equals(txId)) {
|
||||
@ -167,7 +165,6 @@ class TransactionsListItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (amountAsCoin.isZero()) {
|
||||
details = Res.get("funds.tx.noFundsFromDispute");
|
||||
|
@ -445,16 +445,11 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
|
||||
|
||||
private void applyTradeState() {
|
||||
if (trade.isTakerFeePublished()) {
|
||||
if (trade.getTakerFeeTxId() != null) {
|
||||
if (takeOfferResultHandler != null)
|
||||
takeOfferResultHandler.run();
|
||||
|
||||
showTransactionPublishedScreen.set(true);
|
||||
updateSpinnerInfo();
|
||||
} else {
|
||||
final String msg = "trade.getTakerFeeTxId() must not be null.";
|
||||
DevEnv.logErrorAndThrowIfDevMode(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,6 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
|
||||
}
|
||||
|
||||
addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("shared.makerFeeTxId"), offer.getOfferFeePaymentTxId());
|
||||
addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("shared.takerFeeTxId"), trade.getTakerFeeTxId());
|
||||
|
||||
if (trade.getMakerDepositTx() != null)
|
||||
addLabelTxIdTextField(gridPane, ++rowIndex, Res.get("shared.depositTransactionId"), // TODO (woodser): separate UI labels for deposit tx ids
|
||||
|
@ -107,15 +107,12 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
|
||||
private EventHandler<KeyEvent> keyEventEventHandler;
|
||||
private ChangeListener<String> filterTextFieldListener;
|
||||
private Scene scene;
|
||||
private final boolean allowFaultyDelayedTxs;
|
||||
|
||||
@Inject
|
||||
public FailedTradesView(FailedTradesViewModel model,
|
||||
TradeDetailsWindow tradeDetailsWindow,
|
||||
@Named(Config.ALLOW_FAULTY_DELAYED_TXS) boolean allowFaultyDelayedTxs) {
|
||||
TradeDetailsWindow tradeDetailsWindow) {
|
||||
super(model);
|
||||
this.tradeDetailsWindow = tradeDetailsWindow;
|
||||
this.allowFaultyDelayedTxs = allowFaultyDelayedTxs;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -279,9 +276,6 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
|
||||
|
||||
Trade trade = item.getTrade();
|
||||
|
||||
if (trade.getTakerFeeTxId() != null && trade.getTakerFeeTxId().contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
if (trade.getMaker().getDepositTxHash() != null && trade.getMaker().getDepositTxHash().contains(filterString)) {
|
||||
return true;
|
||||
}
|
||||
@ -326,12 +320,6 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
|
||||
log.info("Check unfail found no deposit tx(s) for trade {}", trade.getId());
|
||||
return Res.get("portfolio.failed.depositTxNull");
|
||||
}
|
||||
if (trade.getDelayedPayoutTxBytes() == null) {
|
||||
log.info("Check unfail found no delayedPayoutTxBytes for trade {}", trade.getId());
|
||||
if (!allowFaultyDelayedTxs) {
|
||||
return Res.get("portfolio.failed.delayedPayoutTxNull");
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -412,16 +412,6 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
|
||||
return Res.get("portfolio.pending.failedTrade.missingContract");
|
||||
}
|
||||
|
||||
PubKeyRing myPubKeyRing = model.dataModel.getPubKeyRingProvider().get();
|
||||
boolean isMyRoleBuyer = contract.isMyRoleBuyer(myPubKeyRing);
|
||||
boolean isMyRoleMaker = contract.isMyRoleMaker(myPubKeyRing);
|
||||
|
||||
if (trade.getTakerFeeTxId() == null) {
|
||||
return isMyRoleMaker ?
|
||||
Res.get("portfolio.pending.failedTrade.maker.missingTakerFeeTx") :
|
||||
Res.get("portfolio.pending.failedTrade.taker.missingTakerFeeTx");
|
||||
}
|
||||
|
||||
if (trade.getMakerDepositTx() == null) {
|
||||
return Res.get("portfolio.pending.failedTrade.missingDepositTx");
|
||||
}
|
||||
|
@ -38,9 +38,6 @@ public class FilteringUtils {
|
||||
if (trade == null) {
|
||||
return false;
|
||||
}
|
||||
if (trade.getTakerFeeTxId() != null && StringUtils.containsIgnoreCase(trade.getTakerFeeTxId(), filterString)) {
|
||||
return true;
|
||||
}
|
||||
if (trade.getMaker().getDepositTxHash() != null && StringUtils.containsIgnoreCase(trade.getMaker().getDepositTxHash(), filterString)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -63,12 +63,6 @@ public class TransactionAwareTradeTest {
|
||||
trade = new TransactionAwareTrade(delegate, arbitrationManager, refundManager, xmrWalletService, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsRelatedToTransactionWhenTakerOfferFeeTx() {
|
||||
when(delegate.getTakerFeeTxId()).thenReturn(XID.toString());
|
||||
assertTrue(trade.isRelatedToTransaction(transaction));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsRelatedToTransactionWhenPayoutTx() {
|
||||
when(delegate.getPayoutTx().getHash()).thenReturn(XID.toString());
|
||||
|
@ -1709,36 +1709,32 @@ message Trade {
|
||||
|
||||
Offer offer = 1;
|
||||
ProcessModel process_model = 2;
|
||||
string taker_fee_tx_id = 3;
|
||||
reserved 4;
|
||||
string payout_tx_id = 5;
|
||||
string payout_tx_hex = 6;
|
||||
string payout_tx_key = 7;
|
||||
int64 amount_as_long = 8;
|
||||
int64 tx_fee_as_long = 9;
|
||||
int64 taker_fee_as_long = 10;
|
||||
int64 take_offer_date = 11;
|
||||
int64 price = 12;
|
||||
State state = 13;
|
||||
DisputeState dispute_state = 14;
|
||||
TradePeriodState period_state = 15;
|
||||
Contract contract = 16;
|
||||
string contract_as_json = 17;
|
||||
bytes contract_hash = 18;
|
||||
NodeAddress arbitrator_node_address = 19;
|
||||
NodeAddress mediator_node_address = 20;
|
||||
string error_message = 21;
|
||||
string counter_currency_tx_id = 22;
|
||||
repeated ChatMessage chat_message = 23;
|
||||
MediationResultState mediation_result_state = 24;
|
||||
int64 lock_time = 25;
|
||||
bytes delayed_payout_tx_bytes = 26;
|
||||
NodeAddress refund_agent_node_address = 27;
|
||||
RefundResultState refund_result_state = 28;
|
||||
int64 last_refresh_request_date = 29 [deprecated = true];
|
||||
string counter_currency_extra_data = 30;
|
||||
string asset_tx_proof_result = 31; // name of AssetTxProofResult enum
|
||||
string uid = 32;
|
||||
string payout_tx_id = 3;
|
||||
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;
|
||||
State state = 11;
|
||||
DisputeState dispute_state = 12;
|
||||
TradePeriodState period_state = 13;
|
||||
Contract contract = 14;
|
||||
string contract_as_json = 15;
|
||||
bytes contract_hash = 16;
|
||||
NodeAddress arbitrator_node_address = 17;
|
||||
NodeAddress mediator_node_address = 18;
|
||||
string error_message = 19;
|
||||
string counter_currency_tx_id = 20;
|
||||
repeated ChatMessage chat_message = 21;
|
||||
MediationResultState mediation_result_state = 22;
|
||||
int64 lock_time = 23;
|
||||
NodeAddress refund_agent_node_address = 24;
|
||||
RefundResultState refund_result_state = 25;
|
||||
string counter_currency_extra_data = 26;
|
||||
string asset_tx_proof_result = 27; // name of AssetTxProofResult enum
|
||||
string uid = 28;
|
||||
}
|
||||
|
||||
message BuyerAsMakerTrade {
|
||||
|
Loading…
Reference in New Issue
Block a user