From ea10093dad5106e866ea563f381377889074479a Mon Sep 17 00:00:00 2001 From: woodser Date: Mon, 1 May 2023 12:13:28 -0400 Subject: [PATCH] instruct to stop monero-wallet-rpc processes on error opening wallet --- .../main/java/haveno/core/app/WalletAppSetup.java | 2 +- .../haveno/core/xmr/wallet/XmrWalletService.java | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/haveno/core/app/WalletAppSetup.java b/core/src/main/java/haveno/core/app/WalletAppSetup.java index 867433aa..887c6955 100644 --- a/core/src/main/java/haveno/core/app/WalletAppSetup.java +++ b/core/src/main/java/haveno/core/app/WalletAppSetup.java @@ -156,7 +156,7 @@ public class WalletAppSetup { rejectedTxException.set((RejectedTxException) exception); getWalletServiceErrorMsg().set(Res.get("mainView.walletServiceErrorMsg.rejectedTxException", exception.getMessage())); } else { - getWalletServiceErrorMsg().set(Res.get("mainView.walletServiceErrorMsg.connectionError", exception.toString())); + getWalletServiceErrorMsg().set(Res.get("mainView.walletServiceErrorMsg.connectionError", exception.getMessage())); } } return result; diff --git a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java index 2986ede2..3bc4488c 100644 --- a/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java +++ b/core/src/main/java/haveno/core/xmr/wallet/XmrWalletService.java @@ -232,14 +232,10 @@ public class XmrWalletService { public MoneroWalletRpc openWallet(String walletName) { log.info("{}.openWallet({})", getClass().getSimpleName(), walletName); if (isShutDownStarted) throw new IllegalStateException("Cannot open wallet because shutting down"); - try { - return openWalletRpc(new MoneroWalletConfig() - .setPath(walletName) - .setPassword(getWalletPassword()), + return openWalletRpc(new MoneroWalletConfig() + .setPath(walletName) + .setPassword(getWalletPassword()), null); - } catch (MoneroError e) { - throw new IllegalStateException("Could not open wallet '" + walletName + "'. Please close Haveno, stop all monero-wallet-rpc processes, and restart Haveno."); - } } /** @@ -712,7 +708,7 @@ public class XmrWalletService { } catch (Exception e) { e.printStackTrace(); stopWallet(walletRpc, config.getPath()); - throw e; + throw new IllegalStateException("Could not open wallet '" + config.getPath() + "'. Please close Haveno, stop all monero-wallet-rpc processes, and restart Haveno."); } }