Browse Source

storage upgrade: don't run older upgrade methods on newer version storage

3.1
SomberNight 7 years ago
parent
commit
41e836a9f4
  1. 9
      lib/storage.py

9
lib/storage.py

@ -339,6 +339,9 @@ class WalletStorage(PrintError):
self.write()
def convert_wallet_type(self):
if not self._is_upgrade_method_needed(0, 13):
return
wallet_type = self.get('wallet_type')
if wallet_type == 'btchip': wallet_type = 'ledger'
if self.get('keystore') or self.get('x1/') or wallet_type=='imported':
@ -522,6 +525,9 @@ class WalletStorage(PrintError):
self.put('seed_version', 16)
def convert_imported(self):
if not self._is_upgrade_method_needed(0, 13):
return
# '/x' is the internal ID for imported accounts
d = self.get('accounts', {}).get('/x', {}).get('imported',{})
if not d:
@ -548,6 +554,9 @@ class WalletStorage(PrintError):
raise BaseException('no addresses or privkeys')
def convert_account(self):
if not self._is_upgrade_method_needed(0, 13):
return
self.put('accounts', None)
def _is_upgrade_method_needed(self, min_version, max_version):

Loading…
Cancel
Save