tw.store: new get_tw_dir() classmethod

This commit is contained in:
The MMGen Project 2025-11-15 09:50:21 +00:00
commit f05858a01f
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2

View file

@ -47,12 +47,7 @@ class TwCtlWithStore(TwCtl, metaclass=AsyncInit):
if cfg.cached_balances:
self.use_cached_balances = True
self.tw_dir = Path(
self.cfg.data_dir_root,
'altcoins',
self.proto.coin.lower(),
('' if self.proto.network == 'mainnet' else self.proto.network)
)
self.tw_dir = type(self).get_tw_dir(self.cfg, self.proto)
self.tw_path = self.tw_dir / self.tw_fn
if no_wallet_init:
@ -84,6 +79,14 @@ class TwCtlWithStore(TwCtl, metaclass=AsyncInit):
elif self.cfg.debug:
msg('read-only wallet, doing nothing')
@classmethod
def get_tw_dir(cls, cfg, proto):
return Path(
cfg.data_dir_root,
'altcoins',
proto.coin.lower(),
('' if proto.network == 'mainnet' else proto.network))
def upgrade_wallet_maybe(self):
pass