1
0

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:
ThomasV
2023-08-18 15:13:33 +02:00
parent af2b0f758d
commit b5bc5ff9ed
10 changed files with 159 additions and 146 deletions

View File

@@ -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