Allow Decred wallets derived from the legacy extkey.

When importing from seed dcrwallet creates two accounts, one each on coin_id 20 and 42.

Can't see how to force slip44 upgrade to run in dcrwallet, checking for either key instead.
This commit is contained in:
tecnovert
2024-05-27 15:44:48 +02:00
parent 57bc1d5ccf
commit b077561a6f
5 changed files with 24 additions and 6 deletions

View File

@@ -400,14 +400,14 @@ class DCRInterface(Secp256k1Interface):
default_account_bal = balances['balances'][0] # 0 always default?
return self.make_int(default_account_bal['spendable'])
def getSeedHash(self, seed: bytes) -> bytes:
def getSeedHash(self, seed: bytes, coin_type_id=None) -> bytes:
# m / purpose' / coin_type' / account' / change / address_index
# m/44'/coin_type'/0'/0/0
ek = ExtKeyPair(self.coin_type())
ek.set_seed(seed)
coin_type = self.chainparams_network()['bip44']
coin_type = self.chainparams_network()['bip44'] if coin_type_id is None else coin_type_id
ek_purpose = ek.derive(44 | (1 << 31))
ek_coin = ek_purpose.derive(coin_type | (1 << 31))
ek_account = ek_coin.derive(0 | (1 << 31))

View File

@@ -18,7 +18,6 @@ def createDCRWallet(args, hex_seed, logging, delay_event):
while p.poll() is None:
while len(select.select([pipe_r], [], [], 0)[0]) == 1:
buf = os.read(pipe_r, 1024).decode('utf-8')
logging.debug(f'dcrwallet {buf}')
response = None
if 'Use the existing configured private passphrase' in buf:
response = b'y\n'