Merge pull request #5797 from jmacxx/fix_exception_opening_mediation

Prevent NPE in case delayedPayoutTx is not present (failed trade)
This commit is contained in:
Christoph Atteneder 2021-11-04 11:47:17 +01:00 committed by GitHub
commit 851bdcf9ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -495,7 +495,8 @@ public class PendingTradesDataModel extends ActivatableDataModel {
}
Trade.DisputeState disputeState = trade.getDisputeState();
DisputeManager<? extends DisputeList<Dispute>> disputeManager;
long remainingLockTime = trade.getDelayedPayoutTx().getLockTime() - btcWalletService.getBestChainHeight();
long lockTime = trade.getDelayedPayoutTx() == null ? trade.getLockTime() : trade.getDelayedPayoutTx().getLockTime();
long remainingLockTime = lockTime - btcWalletService.getBestChainHeight();
// In case we re-open a dispute we allow Trade.DisputeState.MEDIATION_REQUESTED
boolean useMediation = disputeState == Trade.DisputeState.NO_DISPUTE ||
(disputeState == Trade.DisputeState.MEDIATION_REQUESTED && remainingLockTime > 0);