From 07cf5e34a3b7d550d09e0a0466b23377bb575429 Mon Sep 17 00:00:00 2001 From: jmacxx <47253594+jmacxx@users.noreply.github.com> Date: Wed, 1 Sep 2021 09:04:52 -0500 Subject: [PATCH] Allow user to initiate arbitration once locktime has expired --- .../pendingtrades/PendingTradesDataModel.java | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java index 62548c91963..b43a4ca52d9 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesDataModel.java @@ -493,12 +493,13 @@ private void doOpenDispute(boolean isSupportTicket, Transaction depositTx) { } Trade.DisputeState disputeState = trade.getDisputeState(); DisputeManager> disputeManager; - boolean useMediation; - boolean useRefundAgent; + long remainingLockTime = trade.getDelayedPayoutTx().getLockTime() - btcWalletService.getBestChainHeight(); // In case we re-open a dispute we allow Trade.DisputeState.MEDIATION_REQUESTED - useMediation = disputeState == Trade.DisputeState.NO_DISPUTE || disputeState == Trade.DisputeState.MEDIATION_REQUESTED; + boolean useMediation = disputeState == Trade.DisputeState.NO_DISPUTE || + (disputeState == Trade.DisputeState.MEDIATION_REQUESTED && remainingLockTime > 0); // In case we re-open a dispute we allow Trade.DisputeState.REFUND_REQUESTED - useRefundAgent = disputeState == Trade.DisputeState.MEDIATION_CLOSED || disputeState == Trade.DisputeState.REFUND_REQUESTED; + boolean useRefundAgent = disputeState == Trade.DisputeState.MEDIATION_CLOSED || + disputeState == Trade.DisputeState.REFUND_REQUESTED || remainingLockTime <= 0; AtomicReference donationAddressString = new AtomicReference<>(""); Transaction delayedPayoutTx = trade.getDelayedPayoutTx(); @@ -579,12 +580,9 @@ private void doOpenDispute(boolean isSupportTicket, Transaction depositTx) { return; } - long lockTime = delayedPayoutTx.getLockTime(); - int bestChainHeight = btcWalletService.getBestChainHeight(); - long remaining = lockTime - bestChainHeight; - if (remaining > 0) { + if (remainingLockTime > 0) { new Popup().instruction(Res.get("portfolio.pending.timeLockNotOver", - FormattingUtils.getDateFromBlockHeight(remaining), remaining)) + FormattingUtils.getDateFromBlockHeight(remainingLockTime), remainingLockTime)) .show(); return; } @@ -621,7 +619,7 @@ private void doOpenDispute(boolean isSupportTicket, Transaction depositTx) { mediationManager.findDispute(tradeId) .ifPresent(mediatorsDispute -> { DisputeResult mediatorsDisputeResult = mediatorsDispute.getDisputeResultProperty().get(); - ChatMessage mediatorsResultMessage = mediatorsDisputeResult.getChatMessage(); + ChatMessage mediatorsResultMessage = mediatorsDisputeResult == null ? null : mediatorsDisputeResult.getChatMessage(); if (mediatorsResultMessage != null) { String mediatorAddress = Res.get("support.mediatorsAddress", mediatorsDispute.getContract().getRefundAgentNodeAddress().getFullAddress());