autosign: remove AutosignConfig class
This commit is contained in:
parent
f4384b8af8
commit
da912caaa4
3 changed files with 20 additions and 12 deletions
|
|
@ -23,9 +23,6 @@ from .wallet import Wallet,get_wallet_cls
|
|||
from .filename import find_file_in_dir
|
||||
from .ui import keypress_confirm
|
||||
|
||||
class AutosignConfig(Config):
|
||||
_set_ok = ('usr_randchars','_proto','outdir','passwd_file')
|
||||
|
||||
class Signable:
|
||||
|
||||
signables = ('transaction','message','xmr_transaction','xmr_wallet_outputs_file')
|
||||
|
|
@ -259,9 +256,6 @@ class Autosign:
|
|||
self.msg_dir = self.mountpoint / 'msg'
|
||||
self.keyfile = self.mountpoint / 'autosign.key'
|
||||
|
||||
cfg.outdir = str(self.tx_dir)
|
||||
cfg.passwd_file = str(self.keyfile)
|
||||
|
||||
if any(k in cfg._uopts for k in ('help','longhelp')):
|
||||
return
|
||||
|
||||
|
|
@ -408,10 +402,20 @@ class Autosign:
|
|||
await asyncio.sleep(0.5)
|
||||
return True
|
||||
|
||||
def update_cfg(self):
|
||||
if not hasattr(self,'_cfg_updated'):
|
||||
self.cfg = Config({
|
||||
'_clone': self.cfg,
|
||||
'outdir': str(self.tx_dir),
|
||||
'passwd_file': str(self.keyfile),
|
||||
})
|
||||
self._cfg_updated = True
|
||||
|
||||
async def do_sign(self):
|
||||
if not self.cfg.stealth_led:
|
||||
self.led.set('busy')
|
||||
self.do_mount()
|
||||
self.update_cfg()
|
||||
key_ok = self.decrypt_wallets()
|
||||
if key_ok:
|
||||
if self.cfg.stealth_led:
|
||||
|
|
@ -492,7 +496,7 @@ class Autosign:
|
|||
ss_in = Wallet( Config(), wf )
|
||||
else:
|
||||
ss_in = Wallet( self.cfg, in_fmt=self.mn_fmts[self.cfg.mnemonic_fmt or self.dfl_mn_fmt] )
|
||||
ss_out = Wallet( self.cfg, ss=ss_in )
|
||||
ss_out = Wallet( self.cfg, ss=ss_in, passwd_file=str(self.keyfile) )
|
||||
ss_out.write_to_file( desc='autosign wallet', outdir=self.wallet_dir )
|
||||
|
||||
@property
|
||||
|
|
@ -533,6 +537,8 @@ class Autosign:
|
|||
except:
|
||||
pass
|
||||
|
||||
self.update_cfg()
|
||||
|
||||
self.xmr_outputs_dir.mkdir(parents=True)
|
||||
|
||||
self.xmr_tx_dir.mkdir(exist_ok=True)
|
||||
|
|
@ -632,7 +638,7 @@ class Autosign:
|
|||
|
||||
def get_autosign_obj(cfg,coins=None):
|
||||
return Autosign(
|
||||
AutosignConfig({
|
||||
Config({
|
||||
'mountpoint': cfg.autosign_mountpoint or cfg.mountpoint,
|
||||
'test_suite': cfg.test_suite,
|
||||
'coins': coins if isinstance(coins,str) else ','.join(coins) if coins else 'btc',
|
||||
|
|
|
|||
|
|
@ -156,9 +156,10 @@ def main(do_loop):
|
|||
|
||||
async_run(do())
|
||||
|
||||
from .autosign import Autosign,AutosignConfig
|
||||
from .cfg import Config
|
||||
from .autosign import Autosign
|
||||
|
||||
cfg = AutosignConfig(
|
||||
cfg = Config(
|
||||
opts_data = opts_data,
|
||||
init_opts = {
|
||||
'quiet': True,
|
||||
|
|
|
|||
|
|
@ -24,10 +24,11 @@ import sys,os,shutil
|
|||
from subprocess import run
|
||||
from pathlib import Path
|
||||
|
||||
from mmgen.cfg import Config
|
||||
from mmgen.color import red,green,blue,purple
|
||||
from mmgen.util import msg,suf,die
|
||||
from mmgen.led import LEDControl
|
||||
from mmgen.autosign import Autosign,AutosignConfig
|
||||
from mmgen.autosign import Autosign
|
||||
|
||||
from ..include.common import (
|
||||
cfg,
|
||||
|
|
@ -85,7 +86,7 @@ class CmdTestAutosignBase(CmdTestBase):
|
|||
self.wallet_dir = Path( self.tmpdir, 'dev.shm.autosign' )
|
||||
|
||||
self.asi = Autosign(
|
||||
AutosignConfig({
|
||||
Config({
|
||||
'coins': ','.join(self.coins),
|
||||
'mountpoint': (
|
||||
None if self.live else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue