prepare: Fix addcoin with encrypted wallets.

Add workaround for Dash: sethdseed error if wallet is encrypted.
This commit is contained in:
tecnovert
2025-04-01 22:49:16 +02:00
parent 31978d9f2a
commit c28eb9ab9b
8 changed files with 78 additions and 42 deletions

View File

@@ -1986,7 +1986,7 @@ class BTCInterface(Secp256k1Interface):
return self.rpc_wallet("encryptwallet", [new_password])
self.rpc_wallet("walletpassphrasechange", [old_password, new_password])
def unlockWallet(self, password: str):
def unlockWallet(self, password: str, check_seed: bool = True) -> None:
if password == "":
return
self._log.info(f"unlockWallet - {self.ticker()}")
@@ -2007,7 +2007,8 @@ class BTCInterface(Secp256k1Interface):
# Max timeout value, ~3 years
self.rpc_wallet("walletpassphrase", [password, 100000000])
self._sc.checkWalletSeed(self.coin_type())
if check_seed:
self._sc.checkWalletSeed(self.coin_type())
def lockWallet(self):
self._log.info(f"lockWallet - {self.ticker()}")

View File

@@ -111,17 +111,11 @@ class DASHInterface(BTCInterface):
return None
def unlockWallet(self, password: str):
super().unlockWallet(password)
def unlockWallet(self, password: str, check_seed: bool = True) -> None:
super().unlockWallet(password, check_seed)
if self._wallet_v20_compatible:
# Store password for initialiseWallet
self._wallet_passphrase = password
if not self._have_checked_seed:
try:
self._sc.checkWalletSeed(self.coin_type())
except Exception as ex:
# dumphdinfo can fail if the wallet is not initialised
self._log.debug(f"DASH checkWalletSeed failed: {ex}.")
def lockWallet(self):
super().lockWallet()

View File

@@ -368,14 +368,15 @@ class DCRInterface(Secp256k1Interface):
# Clear initial password
self._sc.editSettings(self.coin_name().lower(), {"wallet_pwd": ""})
def unlockWallet(self, password: str):
def unlockWallet(self, password: str, check_seed: bool = True) -> None:
if password == "":
return
self._log.info("unlockWallet - {}".format(self.ticker()))
# Max timeout value, ~3 years
self.rpc_wallet("walletpassphrase", [password, 100000000])
self._sc.checkWalletSeed(self.coin_type())
if check_seed:
self._sc.checkWalletSeed(self.coin_type())
def lockWallet(self):
self._log.info("lockWallet - {}".format(self.ticker()))

View File

@@ -146,7 +146,7 @@ class LTCInterfaceMWEB(LTCInterface):
self.rpc_wallet("walletpassphrase", [password, 100000000])
self.rpc_wallet("keypoolrefill")
def unlockWallet(self, password: str):
def unlockWallet(self, password: str, check_seed: bool = True) -> None:
if password == "":
return
self._log.info("unlockWallet - {}".format(self.ticker()))
@@ -156,5 +156,5 @@ class LTCInterfaceMWEB(LTCInterface):
else:
# Max timeout value, ~3 years
self.rpc_wallet("walletpassphrase", [password, 100000000])
self._sc.checkWalletSeed(self.coin_type())
if check_seed:
self._sc.checkWalletSeed(self.coin_type())

View File

@@ -744,11 +744,11 @@ class XMRInterface(CoinInterface):
self._wallet_password = orig_password
raise e
def unlockWallet(self, password: str) -> None:
def unlockWallet(self, password: str, check_seed: bool = True) -> None:
self._log.info("unlockWallet - {}".format(self.ticker()))
self._wallet_password = password
if not self._have_checked_seed:
if check_seed and not self._have_checked_seed:
self._sc.checkWalletSeed(self.coin_type())
def lockWallet(self) -> None: