thardware wallets: detect if label changed and update it in wallet file - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit cbd146ad1501841a05f66135e203cccb3565141d DIR parent 56c3de0e1eb28f6017286f51c37c5c45b86690bd HTML 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: M electrum/keystore.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- DIR diff --git a/electrum/keystore.py b/electrum/keystore.py t@@ -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): t@@ -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 t@@ -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):