Browse Source

trustedcoin: do not require wallet file upgrade

3.3.3.1
ThomasV 6 years ago
parent
commit
852f2a0d65
  1. 10
      electrum/plugins/trustedcoin/trustedcoin.py
  2. 10
      electrum/storage.py

10
electrum/plugins/trustedcoin/trustedcoin.py

@ -249,8 +249,11 @@ class Wallet_2fa(Multisig_Wallet):
self.plugin = None # type: TrustedCoinPlugin
def _load_billing_addresses(self):
billing_addresses = self.storage.get('trustedcoin_billing_addresses', {})
self._billing_addresses = defaultdict(dict) # type: Dict[str, Dict[int, str]] # addr_type -> index -> addr
# type: Dict[str, Dict[int, str]] # addr_type -> index -> addr
self._billing_addresses = {
'legacy': self.storage.get('trustedcoin_billing_addresses', {}),
'segwit': self.storage.get('trustedcoin_billing_addresses_segwit', {})
}
self._billing_addresses_set = set() # set of addrs
for addr_type, d in list(billing_addresses.items()):
self._billing_addresses[addr_type] = {}
@ -349,7 +352,8 @@ class Wallet_2fa(Multisig_Wallet):
billing_addresses_of_this_type[billing_index] = address
self._billing_addresses_set.add(address)
self._billing_addresses[addr_type] = billing_addresses_of_this_type
self.storage.put('trustedcoin_billing_addresses', self._billing_addresses)
self.storage.put('trustedcoin_billing_addresses', self._billing_addresses['legacy'])
self.storage.put('trustedcoin_billing_addresses_segwit', self._billing_addresses['segwit'])
# FIXME this often runs in a daemon thread, where storage.write will fail
self.storage.write()

10
electrum/storage.py

@ -44,7 +44,7 @@ from .keystore import bip44_derivation
OLD_SEED_VERSION = 4 # electrum versions < 2.0
NEW_SEED_VERSION = 11 # electrum versions >= 2.0
FINAL_SEED_VERSION = 19 # electrum >= 2.7 will set this to prevent
FINAL_SEED_VERSION = 18 # electrum >= 2.7 will set this to prevent
# old versions from overwriting new format
@ -354,7 +354,6 @@ class WalletStorage(JsonDB):
self.convert_version_16()
self.convert_version_17()
self.convert_version_18()
self.convert_version_19()
self.put('seed_version', FINAL_SEED_VERSION) # just to be sure
self.write()
@ -576,13 +575,6 @@ class WalletStorage(JsonDB):
self.put('verified_tx3', None)
self.put('seed_version', 18)
def convert_version_19(self):
# delete trustedcoin_billing_addresses
if not self._is_upgrade_method_needed(18, 18):
return
self.put('trustedcoin_billing_addresses', None)
self.put('seed_version', 19)
def convert_imported(self):
if not self._is_upgrade_method_needed(0, 13):
return

Loading…
Cancel
Save