1
0

Separate db from storage

- storage is content-agnostic
 - db and storage are passed to wallet contructor
This commit is contained in:
ThomasV
2020-02-05 15:13:37 +01:00
parent c61e5db6a9
commit e1ce3aace7
25 changed files with 421 additions and 421 deletions

View File

@@ -48,6 +48,7 @@ from electrum.base_wizard import GoBack
from electrum.util import (UserCancelled, profiler,
WalletFileException, BitcoinException, get_new_wallet_name)
from electrum.wallet import Wallet, Abstract_Wallet
from electrum.wallet_db import WalletDB
from electrum.logging import Logger
from .installwizard import InstallWizard, WalletAlreadyOpenInMemory
@@ -306,9 +307,10 @@ class ElectrumGui(Logger):
if storage is None:
wizard.path = path # needed by trustedcoin plugin
wizard.run('new')
storage = wizard.create_storage(path)
storage, db = wizard.create_storage(path)
else:
wizard.run_upgrades(storage)
db = WalletDB(storage.read(), manual_upgrades=False)
wizard.run_upgrades(storage, db)
except (UserCancelled, GoBack):
return
except WalletAlreadyOpenInMemory as e:
@@ -316,9 +318,9 @@ class ElectrumGui(Logger):
finally:
wizard.terminate()
# return if wallet creation is not complete
if storage is None or storage.get_action():
if storage is None or db.get_action():
return
wallet = Wallet(storage, config=self.config)
wallet = Wallet(db, storage, config=self.config)
wallet.start_network(self.daemon.network)
self.daemon.add_wallet(wallet)
return wallet