Skip to content

Commit

Permalink
Merge pull request #5427 from jmacxx/fix_issue_5334
Browse files Browse the repository at this point in the history
Show a SPV resync suggestion if trade remains unconfirmed for 3 hours or more
  • Loading branch information
ripcurlx authored Apr 22, 2021
2 parents c17b46f + 3c3dca0 commit de76bd0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,11 @@ portfolio.pending.invalidTx=There is an issue with a missing or invalid transact
Open a support ticket to get assistance from a Mediator.\n\n\
Error message: {0}

portfolio.pending.unconfirmedTooLong=Security deposit transaction on trade {0} is still unconfirmed after {1} hours. \
Check the deposit transaction at a blockchain explorer. If it has been confirmed but it's not being displayed \
at Bisq, make a data backup and a SPV resync. [HYPERLINK:https://bisq.wiki/Resyncing_SPV_file]\n\n\
Contact Bisq support [HYPERLINK:https://keybase.io/team/bisq] if you have doubts or the issue persists.

portfolio.pending.step1.waitForConf=Wait for blockchain confirmation
portfolio.pending.step2_buyer.startPayment=Start payment
portfolio.pending.step2_seller.waitPaymentStarted=Wait until payment has started
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import bisq.core.support.dispute.mediation.MediationResultState;
import bisq.core.trade.Contract;
import bisq.core.trade.Trade;
import bisq.core.user.DontShowAgainLookup;
import bisq.core.user.Preferences;
import bisq.core.util.FormattingUtils;

Expand Down Expand Up @@ -69,6 +70,9 @@
import javafx.beans.property.BooleanProperty;
import javafx.beans.value.ChangeListener;

import java.time.Duration;
import java.time.Instant;

import java.util.Optional;

import org.slf4j.Logger;
Expand Down Expand Up @@ -730,6 +734,18 @@ private void checkIfLockTimeIsOver() {
}
}

protected void checkForTimeout() {
long unconfirmedHours = Duration.between(trade.getTakeOfferDate().toInstant(), Instant.now()).toHours();
if (unconfirmedHours >= 3 && !trade.hasFailed()) {
String key = "tradeUnconfirmedTooLong_" + trade.getShortId();
if (DontShowAgainLookup.showAgain(key)) {
new Popup().warning(Res.get("portfolio.pending.unconfirmedTooLong", trade.getShortId(), unconfirmedHours))
.dontShowAgainId(key)
.closeButtonText(Res.get("shared.ok"))
.show();
}
}
}

///////////////////////////////////////////////////////////////////////////////////////////
// TradeDurationLimitInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected void onPendingTradesInitialized() {
super.onPendingTradesInitialized();
validatePayoutTx();
validateDepositInputs();
checkForTimeout();
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public SellerStep1View(PendingTradesViewModel model) {
protected void onPendingTradesInitialized() {
super.onPendingTradesInitialized();
validateDepositInputs();
checkForTimeout();
}

///////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit de76bd0

Please sign in to comment.