From c64e8b98856ad3a34be43ed3291169cb52ec66dd Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Thu, 10 Sep 2015 17:57:50 +0900 Subject: [PATCH] Only write wallet if necessary --- gui/qt/main_window.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py index 7b7d150b..fc310a64 100644 --- a/gui/qt/main_window.py +++ b/gui/qt/main_window.py @@ -282,12 +282,13 @@ class ElectrumWindow(QMainWindow, PrintError): def import_old_contacts(self): # backward compatibility: import contacts - addressbook = set(self.wallet.storage.get('contacts', [])) - for k in addressbook: - l = self.wallet.labels.get(k) - if bitcoin.is_address(k) and l: - self.contacts[l] = ('address', k) - self.wallet.storage.put('contacts', None) + old_contacts = self.wallet.storage.get('contacts', []) + if old_contacts: + for k in set(old_contacts): + l = self.wallet.labels.get(k) + if bitcoin.is_address(k) and l: + self.contacts[l] = ('address', k) + self.wallet.storage.put('contacts', None) def update_wallet_format(self): # convert old-format imported keys