mirror of
https://github.com/basicswap/basicswap.git
synced 2026-04-09 10:57:23 +02:00
fix: remove workaround for blank wallet name
This commit is contained in:
@@ -381,7 +381,7 @@ class BTCInterface(Secp256k1Interface):
|
|||||||
|
|
||||||
if self._rpc_wallet not in wallets:
|
if self._rpc_wallet not in wallets:
|
||||||
self._log.debug(
|
self._log.debug(
|
||||||
f"Wallet: {self._rpc_wallet} not active, attempting to load."
|
f'{self.ticker()} wallet: "{self._rpc_wallet}" not active, attempting to load.'
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
self.rpc(
|
self.rpc(
|
||||||
@@ -425,32 +425,43 @@ class BTCInterface(Secp256k1Interface):
|
|||||||
except Exception as create_e:
|
except Exception as create_e:
|
||||||
self._log.error(f"Error creating wallet: {create_e}")
|
self._log.error(f"Error creating wallet: {create_e}")
|
||||||
|
|
||||||
|
if (
|
||||||
|
self._rpc_wallet_watch != self._rpc_wallet
|
||||||
|
and self._rpc_wallet_watch not in wallets
|
||||||
|
):
|
||||||
|
self._log.debug(
|
||||||
|
f'{self.ticker()} watchonly wallet: "{self._rpc_wallet_watch}" not active, attempting to load.'
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
self.rpc(
|
||||||
|
"loadwallet",
|
||||||
|
[
|
||||||
|
self._rpc_wallet_watch,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
wallets = self.rpc("listwallets")
|
||||||
|
except Exception as e:
|
||||||
|
self._log.debug(
|
||||||
|
f'Error loading {self.ticker()} watchonly wallet "{self._rpc_wallet_watch}": {e}.'
|
||||||
|
)
|
||||||
|
|
||||||
# Wallet name is "" for some LTC and PART installs on older cores
|
# Wallet name is "" for some LTC and PART installs on older cores
|
||||||
if self._rpc_wallet not in wallets and len(wallets) > 0:
|
if self._rpc_wallet not in wallets and len(wallets) > 0:
|
||||||
self._log.warning(f"Changing {self.ticker()} wallet name.")
|
if "" in wallets:
|
||||||
for wallet_name in wallets:
|
self._log.warning(
|
||||||
# Skip over other expected wallets
|
f"Nameless {self.ticker()} wallet found."
|
||||||
if wallet_name in ("mweb",):
|
+ '\nPlease set the "wallet_name" coin setting to "" or recreate the wallet'
|
||||||
continue
|
|
||||||
|
|
||||||
change_watchonly_wallet: bool = (
|
|
||||||
self._rpc_wallet_watch == self._rpc_wallet
|
|
||||||
)
|
)
|
||||||
|
# backupwallet and restorewallet with name should work.
|
||||||
|
|
||||||
self._rpc_wallet = wallet_name
|
if self._rpc_wallet not in wallets:
|
||||||
self._log.info(
|
raise RuntimeError(
|
||||||
f"Switched {self.ticker()} wallet name to {self._rpc_wallet}."
|
f'{self.ticker()} wallet "{self._rpc_wallet}" not active'
|
||||||
)
|
)
|
||||||
self.rpc_wallet = make_rpc_func(
|
if self._rpc_wallet_watch not in wallets:
|
||||||
self._rpcport,
|
raise RuntimeError(
|
||||||
self._rpcauth,
|
f'{self.ticker()} watchonly wallet "{self._rpc_wallet_watch}" not active'
|
||||||
host=self._rpc_host,
|
)
|
||||||
wallet=self._rpc_wallet,
|
|
||||||
)
|
|
||||||
if change_watchonly_wallet:
|
|
||||||
self.rpc_wallet_watch = self.rpc_wallet
|
|
||||||
break
|
|
||||||
|
|
||||||
return len(wallets)
|
return len(wallets)
|
||||||
|
|
||||||
def testDaemonRPC(self, with_wallet=True) -> None:
|
def testDaemonRPC(self, with_wallet=True) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user