mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-03 17:29:26 +00:00
Merge pull request #168 from nahuhh/monero_speed
interface: xmr.py allow startup with a busy daemon
This commit is contained in:
commit
25cfcc7cee
2 changed files with 13 additions and 4 deletions
|
@ -999,6 +999,12 @@ class BasicSwap(BaseApp):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.log.error("Sanity checks failed: %s", str(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:
|
elif c == Coins.LTC:
|
||||||
ci_mweb = self.ci(Coins.LTC_MWEB)
|
ci_mweb = self.ci(Coins.LTC_MWEB)
|
||||||
is_encrypted, _ = self.getLockedState()
|
is_encrypted, _ = self.getLockedState()
|
||||||
|
|
|
@ -114,7 +114,7 @@ class XMRInterface(CoinInterface):
|
||||||
log_str: str = ""
|
log_str: str = ""
|
||||||
have_cc_tor_opt = "use_tor" in chain_client_settings
|
have_cc_tor_opt = "use_tor" in chain_client_settings
|
||||||
if have_cc_tor_opt and chain_client_settings["use_tor"] is False:
|
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):
|
elif have_cc_tor_opt is False and is_private_ip_address(rpchost):
|
||||||
log_str = " bypassing proxy (private ip address)"
|
log_str = " bypassing proxy (private ip address)"
|
||||||
else:
|
else:
|
||||||
|
@ -186,16 +186,19 @@ class XMRInterface(CoinInterface):
|
||||||
self.rpc_wallet("open_wallet", params)
|
self.rpc_wallet("open_wallet", params)
|
||||||
# TODO Remove `refresh` after upstream fix to refresh on open_wallet
|
# TODO Remove `refresh` after upstream fix to refresh on open_wallet
|
||||||
self.rpc_wallet("refresh")
|
self.rpc_wallet("refresh")
|
||||||
except Exception:
|
except Exception as e:
|
||||||
self._log.debug(f"Failed to open {self.coin_name()} wallet")
|
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:
|
try:
|
||||||
# TODO Remove `store` after upstream fix to autosave on close_wallet
|
# TODO Remove `store` after upstream fix to autosave on close_wallet
|
||||||
self.rpc_wallet("store")
|
self.rpc_wallet("store")
|
||||||
self.rpc_wallet("close_wallet")
|
self.rpc_wallet("close_wallet")
|
||||||
self._log.debug(f"Attempt to save and close {self.coin_name()} wallet")
|
self._log.debug(f"Attempt to save and close {self.coin_name()} wallet")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._log.debug(f"{self.coin_name()}: {e}")
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.rpc_wallet("open_wallet", params)
|
self.rpc_wallet("open_wallet", params)
|
||||||
# TODO Remove `refresh` after upstream fix to refresh on open_wallet
|
# TODO Remove `refresh` after upstream fix to refresh on open_wallet
|
||||||
self.rpc_wallet("refresh")
|
self.rpc_wallet("refresh")
|
||||||
|
|
Loading…
Reference in a new issue