diff --git a/core/src/main/resources/i18n/displayStrings.properties b/core/src/main/resources/i18n/displayStrings.properties index 2e292d26b75..a4d8fd18d13 100644 --- a/core/src/main/resources/i18n/displayStrings.properties +++ b/core/src/main/resources/i18n/displayStrings.properties @@ -1564,7 +1564,7 @@ settings.net.peer=Peer settings.net.inbound=inbound settings.net.outbound=outbound settings.net.reSyncSPVChainLabel=Resync SPV chain -settings.net.reSyncSPVChainButton=Delete SPV file and resync +settings.net.reSyncSPVChainButton=Resync SPV wallet settings.net.reSyncSPVSuccess=Are you sure you want to do an SPV resync? If you proceed, the SPV chain file will be deleted on the next startup.\n\n\ After the restart it can take a while to resync with the network and you will only see all transactions once the resync is completed.\n\n\ Depending on the number of transactions and the age of your wallet the resync can take up to a few hours and consumes 100% of CPU. \ diff --git a/desktop/src/main/java/bisq/desktop/main/MainViewModel.java b/desktop/src/main/java/bisq/desktop/main/MainViewModel.java index 10148b873f9..3b79982d264 100644 --- a/desktop/src/main/java/bisq/desktop/main/MainViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/MainViewModel.java @@ -387,7 +387,7 @@ private void setupHandlers() { }); bisqSetup.setSpvFileCorruptedHandler(msg -> new Popup().warning(msg) .actionButtonText(Res.get("settings.net.reSyncSPVChainButton")) - .onAction(() -> GUIUtil.reSyncSPVChain(preferences)) + .onAction(GUIUtil::reSyncSPVChain) .show()); bisqSetup.setVoteResultExceptionHandler(voteResultException -> log.warn(voteResultException.toString())); diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java index 9773bf9d4cf..2c7a3a28890 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java @@ -31,12 +31,12 @@ import bisq.core.offer.Offer; import bisq.core.offer.OfferUtil; import bisq.core.provider.fee.FeeService; -import bisq.core.provider.mempool.FeeValidationStatus; import bisq.core.provider.mempool.MempoolService; import bisq.core.trade.ClosedTradableManager; import bisq.core.trade.bisq_v1.TradeUtil; import bisq.core.trade.model.bisq_v1.Contract; import bisq.core.trade.model.bisq_v1.Trade; +import bisq.core.user.DontShowAgainLookup; import bisq.core.user.User; import bisq.core.util.FormattingUtils; import bisq.core.util.VolumeUtil; @@ -63,6 +63,9 @@ import javafx.beans.property.ReadOnlyObjectProperty; import javafx.beans.property.SimpleObjectProperty; +import java.time.Duration; +import java.time.Instant; + import java.util.Date; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; @@ -206,6 +209,33 @@ private void onMessageStateChanged(MessageState messageState) { messageStateProperty.set(messageState); } + public void checkForTimeoutAtTradeStep1() { + if (trade == null) { + return; + } + // Trade is waiting confirmation. If it has been unconfirmed for too long, prompt the user. + long unconfirmedHours = Duration.between(trade.getDate().toInstant(), Instant.now()).toHours(); + if (unconfirmedHours >= 24 && !trade.hasFailed()) { + // PR #6994 - only show a warning popup if a block explorer says it has confirmed + mempoolService.checkTxIsConfirmed(trade.getDepositTxId(), (validator -> { + long confirms = validator.parseJsonValidateTx(); + log.info("Mempool lookup of deposit tx returned {} confirms for trade {}", confirms, trade.getShortId()); + if (confirms < 1) { + return; + } + String key = "tradeUnconfirmedTooLong_" + trade.getShortId(); + if (DontShowAgainLookup.showAgain(key)) { + new Popup().warning(Res.get("portfolio.pending.unconfirmedTooLong", trade.getShortId(), unconfirmedHours)) + .dontShowAgainId(key) + .actionButtonText(Res.get("settings.net.reSyncSPVChainButton")) + .closeButtonText(Res.get("shared.ok")) + .onAction(GUIUtil::reSyncSPVChain) + .show(); + } + })); + } + } + public void checkTakerFeeTx(Trade trade) { UserThread.runAfter(() -> { mempoolService.validateOfferTakerTx(trade, (txValidator -> { diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java index b86ace6c20d..89522e5cbc0 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/TradeStepView.java @@ -34,7 +34,6 @@ import bisq.core.support.dispute.mediation.MediationResultState; import bisq.core.trade.model.bisq_v1.Contract; import bisq.core.trade.model.bisq_v1.Trade; -import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; import bisq.core.util.FormattingUtils; @@ -71,9 +70,6 @@ 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; @@ -739,19 +735,6 @@ private void checkIfLockTimeIsOver() { } } - protected void checkForTimeout() { - long unconfirmedHours = Duration.between(trade.getDate().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 /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep1View.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep1View.java index de6c6ec8e2f..f0a22e2fe39 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep1View.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep1View.java @@ -40,7 +40,7 @@ protected void onPendingTradesInitialized() { super.onPendingTradesInitialized(); validatePayoutTx(); validateDepositInputs(); - checkForTimeout(); + model.checkForTimeoutAtTradeStep1(); } diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep1View.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep1View.java index 9696afdf305..a85fbc57305 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep1View.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/seller/SellerStep1View.java @@ -38,7 +38,7 @@ public SellerStep1View(PendingTradesViewModel model) { protected void onPendingTradesInitialized() { super.onPendingTradesInitialized(); validateDepositInputs(); - checkForTimeout(); + model.checkForTimeoutAtTradeStep1(); } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java b/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java index 19071fb841d..ae5712352b7 100644 --- a/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java +++ b/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java @@ -293,7 +293,7 @@ public void activate() { } }); - reSyncSPVChainButton.setOnAction(event -> GUIUtil.reSyncSPVChain(preferences)); + reSyncSPVChainButton.setOnAction(event -> GUIUtil.reSyncSPVChain()); bitcoinPeersSubscription = EasyBind.subscribe(walletsSetup.connectedPeersProperty(), connectedPeers -> updateBitcoinPeersTable()); diff --git a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java index 4d9678dee87..1d2f5b77b50 100644 --- a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java @@ -887,7 +887,7 @@ public static void requestFocus(Node node) { UserThread.execute(node::requestFocus); } - public static void reSyncSPVChain(Preferences preferences) { + public static void reSyncSPVChain() { try { new Popup().information(Res.get("settings.net.reSyncSPVSuccess")) .useShutDownButton()