Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a SPV resync suggestion if trade remains unconfirmed for 3 hours or more #5427

Merged
merged 1 commit into from Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -591,6 +591,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