bip32: fix hardened char "h" vs "'" compatibility for some hw wallets
in particular, ledger: fix sign_message for some wallets
```
156.02 | E | plugins.ledger.ledger |
Traceback (most recent call last):
File "...\electrum\electrum\plugins\ledger\ledger.py", line 1265, in sign_message
result = base64.b64decode(self.client.sign_message(message, address_path))
File "...\Python310\site-packages\ledger_bitcoin\client.py", line 230, in sign_message
sw, response = self._make_request(self.builder.sign_message(message_bytes, bip32_path), client_intepreter)
File "...\Python310\site-packages\ledger_bitcoin\command_builder.py", line 176, in sign_message
bip32_path: List[bytes] = bip32_path_from_string(bip32_path)
File "...\Python310\site-packages\ledger_bitcoin\common.py", line 68, in bip32_path_from_string
return [int(p).to_bytes(4, byteorder="big") if "'" not in p
File "...\Python310\site-packages\ledger_bitcoin\common.py", line 68, in <listcomp>
return [int(p).to_bytes(4, byteorder="big") if "'" not in p
ValueError: invalid literal for int() with base 10: '84h'
```
Regression from df2bd61de6, where the
default hardened char was changed from "'" to "h". Note that there was
no corresponding wallet db upgrade, so some files use one char and
others use the other.
This commit is contained in:
@@ -508,7 +508,9 @@ class Xpub(MasterPublicKeyMixin):
|
||||
return self._xpub_bip32_node
|
||||
|
||||
def get_derivation_prefix(self) -> Optional[str]:
|
||||
return self._derivation_prefix
|
||||
if self._derivation_prefix is None:
|
||||
return None
|
||||
return normalize_bip32_derivation(self._derivation_prefix)
|
||||
|
||||
def get_root_fingerprint(self) -> Optional[str]:
|
||||
return self._root_fingerprint
|
||||
|
||||
Reference in New Issue
Block a user