Separate WalletDB from storage upgrades.
Make sure that WalletDB.data is always a StoredDict. Perform db upgrades in a separate class, since they operate on a dict object.
This commit is contained in:
@@ -47,7 +47,7 @@ from .util import log_exceptions, ignore_exceptions, randrange, OldTaskGroup
|
||||
from .util import EventListener, event_listener
|
||||
from .wallet import Wallet, Abstract_Wallet
|
||||
from .storage import WalletStorage
|
||||
from .wallet_db import WalletDB
|
||||
from .wallet_db import WalletDB, WalletRequiresSplit, WalletRequiresUpgrade
|
||||
from .commands import known_commands, Commands
|
||||
from .simple_config import SimpleConfig
|
||||
from .exchange_rate import FxThread
|
||||
@@ -512,10 +512,11 @@ class Daemon(Logger):
|
||||
return
|
||||
storage.decrypt(password)
|
||||
# read data, pass it to db
|
||||
db = WalletDB(storage.read(), storage=storage, manual_upgrades=manual_upgrades)
|
||||
if db.requires_split():
|
||||
try:
|
||||
db = WalletDB(storage.read(), storage=storage, manual_upgrades=manual_upgrades)
|
||||
except WalletRequiresSplit:
|
||||
return
|
||||
if db.requires_upgrade():
|
||||
except WalletRequiresUpgrade:
|
||||
return
|
||||
if db.get_action():
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user