diff --git a/Makefile b/Makefile index e872bdc0fb..f4c374fd21 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,8 @@ user1-desktop-local: --appName=haveno-XMR_LOCAL_user1 \ --apiPassword=apitest \ --apiPort=9999 \ - --walletRpcBindPort=38091 + --walletRpcBindPort=38091 \ + --logLevel=info user2-desktop-local: ./haveno-desktop$(APP_EXT) \ diff --git a/core/src/main/java/haveno/core/trade/Trade.java b/core/src/main/java/haveno/core/trade/Trade.java index a50652e7e5..ca38c287ac 100644 --- a/core/src/main/java/haveno/core/trade/Trade.java +++ b/core/src/main/java/haveno/core/trade/Trade.java @@ -436,7 +436,7 @@ public abstract class Trade implements Tradable, Model { transient Boolean makerDepositLocked; // null when unknown, true while locked, false when unlocked transient Boolean takerDepositLocked; @Nullable - transient private MoneroTxWallet payoutTx; + transient private MoneroTx payoutTx; @Getter @Setter private String payoutTxId; @@ -667,7 +667,16 @@ public abstract class Trade implements Tradable, Model { // sync wallet if applicable if (!isDepositRequested() || isPayoutUnlocked()) return; - if (!walletExists()) throw new IllegalStateException("Missing trade wallet for " + getClass().getSimpleName() + " " + getId()); + if (!walletExists()) { + MoneroTx payoutTx = getPayoutTx(); + if (payoutTx != null && payoutTx.getNumConfirmations() >= 10) { + log.warn("Payout state for {} {} is {} but payout is unlocked, updating state", getClass().getSimpleName(), getId(), getPayoutState()); + setPayoutStateUnlocked(); + return; + } else { + throw new IllegalStateException("Missing trade wallet for " + getClass().getSimpleName() + " " + getId()); + } + } if (xmrWalletService.getConnectionsService().getConnection() == null || Boolean.FALSE.equals(xmrWalletService.getConnectionsService().isConnected())) return; updateSyncing(); } @@ -1631,8 +1640,10 @@ public abstract class Trade implements Tradable, Model { } @Nullable - public MoneroTxWallet getPayoutTx() { - if (payoutTx == null) payoutTx = payoutTxId == null ? null : xmrWalletService.getWallet().getTx(payoutTxId); + public MoneroTx getPayoutTx() { + if (payoutTx == null) { + payoutTx = payoutTxId == null ? null : (this instanceof ArbitratorTrade) ? xmrWalletService.getTxWithCache(payoutTxId) : xmrWalletService.getWallet().getTx(payoutTxId); + } return payoutTx; } diff --git a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTrade.java b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTrade.java index 9e4d5e59cd..b9d1fdf991 100644 --- a/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTrade.java +++ b/desktop/src/main/java/haveno/desktop/main/funds/transactions/TransactionAwareTrade.java @@ -69,7 +69,7 @@ class TransactionAwareTrade implements TransactionAwareTradable { private boolean isPayoutTx(String txId) { return Optional.ofNullable(trade.getPayoutTx()) - .map(MoneroTxWallet::getHash) + .map(MoneroTx::getHash) .map(hash -> hash.equals(txId)) .orElse(false); } diff --git a/desktop/src/main/java/haveno/desktop/main/overlays/windows/DisputeSummaryWindow.java b/desktop/src/main/java/haveno/desktop/main/overlays/windows/DisputeSummaryWindow.java index cec65b924c..1d7e092f32 100644 --- a/desktop/src/main/java/haveno/desktop/main/overlays/windows/DisputeSummaryWindow.java +++ b/desktop/src/main/java/haveno/desktop/main/overlays/windows/DisputeSummaryWindow.java @@ -66,6 +66,7 @@ import javafx.scene.layout.GridPane; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import lombok.extern.slf4j.Slf4j; +import monero.daemon.model.MoneroTx; import monero.wallet.model.MoneroTxWallet; import java.math.BigInteger; @@ -581,11 +582,11 @@ public class DisputeSummaryWindow extends Overlay { closeTicketButton.setOnAction(e -> { // get or create dispute payout tx - MoneroTxWallet payoutTx = null; + MoneroTx payoutTx = null; if (trade.isPayoutPublished()) payoutTx = trade.getPayoutTx(); else { payoutTx = arbitrationManager.createDisputePayoutTx(trade, dispute.getContract(), disputeResult, false); - trade.getProcessModel().setUnsignedPayoutTx(payoutTx); + trade.getProcessModel().setUnsignedPayoutTx((MoneroTxWallet) payoutTx); } // show confirmation @@ -608,7 +609,7 @@ public class DisputeSummaryWindow extends Overlay { }); } - private void showPayoutTxConfirmation(Contract contract, DisputeResult disputeResult, MoneroTxWallet payoutTx, ResultHandler resultHandler) { + private void showPayoutTxConfirmation(Contract contract, DisputeResult disputeResult, MoneroTx payoutTx, ResultHandler resultHandler) { BigInteger buyerPayoutAmount = disputeResult.getBuyerPayoutAmount(); String buyerPayoutAddressString = contract.getBuyerPayoutAddressString(); BigInteger sellerPayoutAmount = disputeResult.getSellerPayoutAmount();