From cbd146ad1501841a05f66135e203cccb3565141d Mon Sep 17 00:00:00 2001 From: SomberNight Date: Sun, 17 Nov 2019 01:17:38 +0100 Subject: [PATCH] hardware wallets: detect if label changed and update it in wallet file --- electrum/keystore.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/electrum/keystore.py b/electrum/keystore.py index f506792d4..9904319c2 100644 --- 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):