walletdb: rm some dead code
This commit is contained in:
@@ -228,8 +228,7 @@ class JsonDB(Logger):
|
|||||||
if self.storage and self.storage.file_exists():
|
if self.storage and self.storage.file_exists():
|
||||||
self.write_and_force_consolidation()
|
self.write_and_force_consolidation()
|
||||||
|
|
||||||
def load_data(self, s:str) -> dict:
|
def load_data(self, s: str) -> dict:
|
||||||
""" overloaded in wallet_db """
|
|
||||||
if s == '':
|
if s == '':
|
||||||
return {}
|
return {}
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -388,10 +388,6 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
|||||||
network: Optional['Network']
|
network: Optional['Network']
|
||||||
|
|
||||||
def __init__(self, db: WalletDB, *, config: SimpleConfig):
|
def __init__(self, db: WalletDB, *, config: SimpleConfig):
|
||||||
|
|
||||||
#if not db.is_ready_to_be_used_by_wallet():
|
|
||||||
# raise Exception("storage not ready to be used by Abstract_Wallet")
|
|
||||||
|
|
||||||
self.config = config
|
self.config = config
|
||||||
assert self.config is not None, "config must not be None"
|
assert self.config is not None, "config must not be None"
|
||||||
self.db = db
|
self.db = db
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ from .json_db import StoredDict, JsonDB, locked, modifier, StoredObject, stored_
|
|||||||
from .plugin import run_hook, plugin_loaders
|
from .plugin import run_hook, plugin_loaders
|
||||||
from .version import ELECTRUM_VERSION
|
from .version import ELECTRUM_VERSION
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .storage import WalletStorage
|
||||||
|
|
||||||
|
|
||||||
class WalletRequiresUpgrade(WalletFileException):
|
class WalletRequiresUpgrade(WalletFileException):
|
||||||
pass
|
pass
|
||||||
@@ -1204,7 +1207,7 @@ class WalletDBUpgrader(Logger):
|
|||||||
raise WalletFileException(msg)
|
raise WalletFileException(msg)
|
||||||
|
|
||||||
|
|
||||||
def upgrade_wallet_db(data: dict, do_upgrade) -> Tuple[dict, bool]:
|
def upgrade_wallet_db(data: dict, do_upgrade: bool) -> Tuple[dict, bool]:
|
||||||
was_upgraded = False
|
was_upgraded = False
|
||||||
|
|
||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
@@ -1232,7 +1235,13 @@ def upgrade_wallet_db(data: dict, do_upgrade) -> Tuple[dict, bool]:
|
|||||||
|
|
||||||
class WalletDB(JsonDB):
|
class WalletDB(JsonDB):
|
||||||
|
|
||||||
def __init__(self, s, *, storage=None, upgrade=False):
|
def __init__(
|
||||||
|
self,
|
||||||
|
s: str,
|
||||||
|
*,
|
||||||
|
storage: Optional['WalletStorage'] = None,
|
||||||
|
upgrade: bool = False,
|
||||||
|
):
|
||||||
JsonDB.__init__(self, s, storage, encoder=MyEncoder, upgrader=partial(upgrade_wallet_db, do_upgrade=upgrade))
|
JsonDB.__init__(self, s, storage, encoder=MyEncoder, upgrader=partial(upgrade_wallet_db, do_upgrade=upgrade))
|
||||||
# create pointers
|
# create pointers
|
||||||
self.load_transactions()
|
self.load_transactions()
|
||||||
@@ -1649,9 +1658,6 @@ class WalletDB(JsonDB):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def is_ready_to_be_used_by_wallet(self):
|
|
||||||
return not self._requires_upgrade
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def split_accounts(klass, root_path, split_data):
|
def split_accounts(klass, root_path, split_data):
|
||||||
from .storage import WalletStorage
|
from .storage import WalletStorage
|
||||||
|
|||||||
Reference in New Issue
Block a user