mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 17:01:34 +00:00
fix wallet constructor
This commit is contained in:
parent
0606a30804
commit
b22048fdfb
1 changed files with 20 additions and 21 deletions
|
@ -1605,9 +1605,16 @@ class Wallet(object):
|
||||||
|
|
||||||
def __new__(self, storage):
|
def __new__(self, storage):
|
||||||
|
|
||||||
if not storage.file_exists:
|
run_hook('add_wallet_types', wallet_types)
|
||||||
return NewWallet(storage)
|
wallet_type = storage.get('wallet_type')
|
||||||
|
if wallet_type:
|
||||||
|
for cat, t, name, c in wallet_types:
|
||||||
|
if t == wallet_type:
|
||||||
|
WalletClass = c
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise BaseException('unknown wallet type', wallet_type)
|
||||||
|
else:
|
||||||
seed_version = storage.get('seed_version')
|
seed_version = storage.get('seed_version')
|
||||||
if not seed_version:
|
if not seed_version:
|
||||||
seed_version = OLD_SEED_VERSION if len(storage.get('master_public_key','')) == 128 else NEW_SEED_VERSION
|
seed_version = OLD_SEED_VERSION if len(storage.get('master_public_key','')) == 128 else NEW_SEED_VERSION
|
||||||
|
@ -1620,19 +1627,11 @@ class Wallet(object):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if seed_version == OLD_SEED_VERSION:
|
if seed_version == OLD_SEED_VERSION:
|
||||||
return OldWallet(storage)
|
WalletClass = OldWallet
|
||||||
|
else:
|
||||||
|
WalletClass = NewWallet
|
||||||
|
|
||||||
config = storage.config
|
|
||||||
run_hook('add_wallet_types', wallet_types)
|
|
||||||
wallet_type = storage.get('wallet_type')
|
|
||||||
if wallet_type:
|
|
||||||
for cat, t, name, WalletClass in wallet_types:
|
|
||||||
if t == wallet_type:
|
|
||||||
return WalletClass(storage)
|
return WalletClass(storage)
|
||||||
else:
|
|
||||||
raise BaseException('unknown wallet type', wallet_type)
|
|
||||||
else:
|
|
||||||
return NewWallet(storage)
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def is_seed(self, seed):
|
def is_seed(self, seed):
|
||||||
|
|
Loading…
Add table
Reference in a new issue