electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit cbd146ad1501841a05f66135e203cccb3565141d
parent 56c3de0e1eb28f6017286f51c37c5c45b86690bd
Author: SomberNight <somber.night@protonmail.com>
Date:   Sun, 17 Nov 2019 01:17:38 +0100

hardware wallets: detect if label changed and update it in wallet file

Diffstat:
Melectrum/keystore.py | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/electrum/keystore.py b/electrum/keystore.py @@ -45,7 +45,7 @@ from .logging import Logger if TYPE_CHECKING: from .transaction import Transaction, PartialTransaction, PartialTxInput, PartialTxOutput - from .plugins.hw_wallet import HW_PluginBase + from .plugins.hw_wallet import HW_PluginBase, HardwareClientBase class KeyStore(Logger): @@ -703,7 +703,7 @@ class Hardware_KeyStore(KeyStore, Xpub): def ready_to_sign(self): return super().ready_to_sign() and self.has_usable_connection_with_device() - def opportunistically_fill_in_missing_info_from_device(self, client): + def opportunistically_fill_in_missing_info_from_device(self, client: 'HardwareClientBase'): assert client is not None if self._root_fingerprint is None: # digitalbitbox (at least) does not reveal xpubs corresponding to unhardened paths @@ -712,6 +712,9 @@ class Hardware_KeyStore(KeyStore, Xpub): root_fingerprint = BIP32Node.from_xkey(child_of_root_xpub).fingerprint.hex().lower() self._root_fingerprint = root_fingerprint self.is_requesting_to_be_rewritten_to_wallet_file = True + if self.label != client.label(): + self.label = client.label() + self.is_requesting_to_be_rewritten_to_wallet_file = True def bip39_normalize_passphrase(passphrase):