commit c64e8b98856ad3a34be43ed3291169cb52ec66dd
parent 084a352456a241b6ff4de19f025251f27bf91715
Author: Neil Booth <kyuupichan@gmail.com>
Date: Thu, 10 Sep 2015 17:57:50 +0900
Only write wallet if necessary
Diffstat:
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git 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