electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 41e836a9f4cc25362e0a77e034fad61b2df3c851
parent d56dba80392bd5e7d679ab9483b2cbfd50d4c506
Author: SomberNight <somber.night@protonmail.com>
Date:   Tue,  6 Feb 2018 23:15:08 +0100

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

Diffstat:
Mlib/storage.py | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/lib/storage.py b/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):