Only write wallet if necessary

This commit is contained in:
Neil Booth 2015-09-10 17:57:50 +09:00
parent 084a352456
commit c64e8b9885
1 changed files with 7 additions and 6 deletions

View File

@ -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