|
|
@@ -32,8 +32,7 @@ class OpWallet(OpBase):
|
|
|
'no_start_wallet_daemon',
|
|
|
'no_stop_wallet_daemon',
|
|
|
'autosign',
|
|
|
- 'watch_only',
|
|
|
- )
|
|
|
+ 'watch_only')
|
|
|
wallet_offline = False
|
|
|
wallet_exists = True
|
|
|
start_daemon = True
|
|
|
@@ -70,8 +69,7 @@ class OpWallet(OpBase):
|
|
|
test_suite = self.cfg.test_suite,
|
|
|
monerod_addr = self.cfg.daemon or None,
|
|
|
trust_monerod = self.trust_monerod,
|
|
|
- test_monerod = not self.wallet_offline,
|
|
|
- )
|
|
|
+ test_monerod = not self.wallet_offline)
|
|
|
|
|
|
if self.wallet_offline:
|
|
|
self.wd.usr_daemon_args = ['--offline']
|
|
|
@@ -79,8 +77,7 @@ class OpWallet(OpBase):
|
|
|
self.c = MoneroWalletRPCClient(
|
|
|
cfg = self.cfg,
|
|
|
daemon = self.wd,
|
|
|
- test_connection = False,
|
|
|
- )
|
|
|
+ test_connection = False)
|
|
|
|
|
|
if self.cfg.offline:
|
|
|
from ...wallet import Wallet
|
|
|
@@ -100,11 +97,14 @@ class OpWallet(OpBase):
|
|
|
self.mount_removable_device()
|
|
|
# with watch_only, make a second attempt to open the file as KeyAddrList:
|
|
|
for first_try in (True, False):
|
|
|
+ addr_list = ViewKeyAddrList if (self.cfg.watch_only and first_try) else KeyAddrList
|
|
|
try:
|
|
|
- self.kal = (ViewKeyAddrList if (self.cfg.watch_only and first_try) else KeyAddrList)(
|
|
|
+ self.kal = addr_list(
|
|
|
cfg = cfg,
|
|
|
proto = self.proto,
|
|
|
- infile = str(self.autosign_viewkey_addr_file) if self.cfg.autosign else self.uargs.infile,
|
|
|
+ infile =
|
|
|
+ str(self.autosign_viewkey_addr_file) if self.cfg.autosign else
|
|
|
+ self.uargs.infile,
|
|
|
key_address_validity_check = True,
|
|
|
skip_chksum_msg = True)
|
|
|
break
|
|
|
@@ -134,7 +134,9 @@ class OpWallet(OpBase):
|
|
|
|
|
|
def get_coin_daemon_rpc(self):
|
|
|
|
|
|
- host, port = self.cfg.daemon.split(':') if self.cfg.daemon else ('localhost', self.wd.monerod_port)
|
|
|
+ host, port = (
|
|
|
+ self.cfg.daemon.split(':') if self.cfg.daemon else
|
|
|
+ ('localhost', self.wd.monerod_port))
|
|
|
|
|
|
from ...daemon import CoinDaemon
|
|
|
return MoneroRPCClient(
|
|
|
@@ -154,10 +156,9 @@ class OpWallet(OpBase):
|
|
|
die(2,
|
|
|
'{a} viewkey-address files found in autosign mountpoint directory ‘{b}’!\n'.format(
|
|
|
a = 'Multiple' if flist else 'No',
|
|
|
- b = self.asi.xmr_dir
|
|
|
- )
|
|
|
- + 'Have you run ‘mmgen-autosign setup’ on your offline machine with the --xmrwallets option?'
|
|
|
- )
|
|
|
+ b = self.asi.xmr_dir)
|
|
|
+ + 'Have you run ‘mmgen-autosign setup’ on your offline machine'
|
|
|
+ ' with the --xmrwallets option?')
|
|
|
else:
|
|
|
return flist[0]
|
|
|
|
|
|
@@ -166,7 +167,9 @@ class OpWallet(OpBase):
|
|
|
idxs = AddrIdxList(fmt_str=self.uargs.wallets)
|
|
|
self.addr_data = [d for d in self.kal.data if d.idx in idxs]
|
|
|
if len(self.addr_data) != len(idxs):
|
|
|
- die(1, f'List {self.uargs.wallets!r} contains addresses not present in supplied key-address file')
|
|
|
+ die(1,
|
|
|
+ f'List {self.uargs.wallets!r} contains addresses not present'
|
|
|
+ ' in supplied key-address file')
|
|
|
else:
|
|
|
self.addr_data = self.kal.data
|
|
|
|
|
|
@@ -179,7 +182,7 @@ class OpWallet(OpBase):
|
|
|
try:
|
|
|
await self.c.stop_daemon()
|
|
|
except KeyboardInterrupt:
|
|
|
- ymsg('\nForce killing wallet daemon')
|
|
|
+ ymsg('\nForce-killing wallet daemon')
|
|
|
self.c.daemon.force_kill = True
|
|
|
self.c.daemon.stop()
|
|
|
|
|
|
@@ -192,8 +195,7 @@ class OpWallet(OpBase):
|
|
|
a = self.kal.al_id.sid,
|
|
|
b = data.idx,
|
|
|
c = 'WatchOnly' if watch_only else '',
|
|
|
- d = f'.{self.cfg.network}' if self.cfg.network != 'mainnet' else '')
|
|
|
- )
|
|
|
+ d = f'.{self.cfg.network}' if self.cfg.network != 'mainnet' else ''))
|
|
|
|
|
|
@property
|
|
|
def add_wallet_desc(self):
|
|
|
@@ -212,8 +214,7 @@ class OpWallet(OpBase):
|
|
|
a = self.stem.capitalize(),
|
|
|
b = n + 1,
|
|
|
c = len(self.addr_data),
|
|
|
- d = fn.name,
|
|
|
- ))
|
|
|
+ d = fn.name))
|
|
|
processed += await self.process_wallet(d, fn, last=n==len(self.addr_data)-1)
|
|
|
gmsg(f'\n{processed} wallet{suf(processed)} {self.stem}ed\n')
|
|
|
return processed
|
|
|
@@ -223,5 +224,4 @@ class OpWallet(OpBase):
|
|
|
a = self.action.capitalize(),
|
|
|
b = self.add_wallet_desc,
|
|
|
c = wallet_idx,
|
|
|
- d = fn.name
|
|
|
- ))
|
|
|
+ d = fn.name))
|