From ad43ce40957cf7011eef0e3b70716ea51c40741e Mon Sep 17 00:00:00 2001 From: nahuhh <50635951+nahuhh@users.noreply.github.com> Date: Wed, 27 Nov 2024 04:15:33 +0000 Subject: [PATCH 1/2] interface: xmr.py allow startup with a busy daemon --- basicswap/interface/xmr.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/basicswap/interface/xmr.py b/basicswap/interface/xmr.py index 80cb7c1..355cab2 100644 --- a/basicswap/interface/xmr.py +++ b/basicswap/interface/xmr.py @@ -114,7 +114,7 @@ class XMRInterface(CoinInterface): log_str: str = "" have_cc_tor_opt = "use_tor" in chain_client_settings if have_cc_tor_opt and chain_client_settings["use_tor"] is False: - log_str = " bypassing proxy (use_tor false for XMR)" + log_str = f" bypassing proxy (use_tor false for {self.coin_name()})" elif have_cc_tor_opt is False and is_private_ip_address(rpchost): log_str = " bypassing proxy (private ip address)" else: @@ -186,16 +186,19 @@ class XMRInterface(CoinInterface): self.rpc_wallet("open_wallet", params) # TODO Remove `refresh` after upstream fix to refresh on open_wallet self.rpc_wallet("refresh") - except Exception: - self._log.debug(f"Failed to open {self.coin_name()} wallet") + except Exception as e: + if "no connection to daemon" in str(e): + self._log.debug(f"{self.coin_name()} {e}") + return # bypass refresh error to allow startup with a busy daemon + try: # TODO Remove `store` after upstream fix to autosave on close_wallet self.rpc_wallet("store") self.rpc_wallet("close_wallet") self._log.debug(f"Attempt to save and close {self.coin_name()} wallet") except Exception as e: - self._log.debug(f"{self.coin_name()}: {e}") pass + self.rpc_wallet("open_wallet", params) # TODO Remove `refresh` after upstream fix to refresh on open_wallet self.rpc_wallet("refresh") From e7a70f1e26397c3563215b9833340a334872b2a9 Mon Sep 17 00:00:00 2001 From: nahuhh <50635951+nahuhh@users.noreply.github.com> Date: Wed, 27 Nov 2024 06:17:46 +0000 Subject: [PATCH 2/2] basicswap: revert removal of ensureWalletExists --- basicswap/basicswap.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/basicswap/basicswap.py b/basicswap/basicswap.py index 79a5d16..23396f0 100644 --- a/basicswap/basicswap.py +++ b/basicswap/basicswap.py @@ -999,6 +999,12 @@ class BasicSwap(BaseApp): except Exception as e: self.log.error("Sanity checks failed: %s", str(e)) + elif c in (Coins.XMR, Coins.WOW): + try: + ci.ensureWalletExists() + except Exception as e: + self.log.warning("Can't open %s wallet, could be locked.", ci.coin_name()) + continue elif c == Coins.LTC: ci_mweb = self.ci(Coins.LTC_MWEB) is_encrypted, _ = self.getLockedState()