Browse Source

Merge pull request #3004 from SomberNight/wallet_conversion_v13_to_v14

fix: v13 to v14 wallet (with Imported_KeyStore) conversion
seed_v14
ThomasV 7 years ago
committed by GitHub
parent
commit
5127dabb0d
  1. 10
      lib/storage.py

10
lib/storage.py

@ -345,13 +345,13 @@ class WalletStorage(PrintError):
self.put('addresses', addresses) self.put('addresses', addresses)
elif self.get('wallet_type') == 'standard': elif self.get('wallet_type') == 'standard':
if self.get('keystore').get('type')=='imported': if self.get('keystore').get('type')=='imported':
addresses = self.get('addresses').get('receiving') addresses = set(self.get('addresses').get('receiving'))
pubkeys = self.get('pubkeys').get('receiving') pubkeys = self.get('keystore').get('keypairs').keys()
assert len(addresses) == len(pubkeys) assert len(addresses) == len(pubkeys)
d = {} d = {}
for i in range(len(addresses)): for pubkey in pubkeys:
addr = addresses[i] addr = bitcoin.pubkey_to_address('p2pkh', pubkey)
pubkey = pubkeys[i] assert addr in addresses
d[addr] = { 'pubkey':pubkey, 'type':'p2pkh'} d[addr] = { 'pubkey':pubkey, 'type':'p2pkh'}
self.put('addresses', d) self.put('addresses', d)
self.put('pubkeys', None) self.put('pubkeys', None)

Loading…
Cancel
Save