minor fixes and cleanups

This commit is contained in:
The MMGen Project 2021-10-10 20:18:14 +00:00
commit d70f3a7c1f
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
8 changed files with 30 additions and 15 deletions

View file

@ -108,7 +108,6 @@ class GlobalContext(Lockable):
monero_wallet_rpc_host = 'localhost'
monero_wallet_rpc_user = 'monero'
monero_wallet_rpc_password = ''
rpc_fail_on_command = ''
aiohttp_rpc_queue_len = 16
session = None
cached_balances = False

View file

@ -314,8 +314,6 @@ class RPCClient(MMGenObject):
"""
default call: call with param list unrolled, exactly as with cli
"""
if method == g.rpc_fail_on_command:
method = 'badcommand_' + method
return await self.process_http_resp(self.backend.run(
payload = {'id': 1, 'jsonrpc': '2.0', 'method': method, 'params': params },
timeout = timeout,
@ -715,7 +713,8 @@ class MoneroWalletRPCClient(MoneroRPCClient):
'create_wallet', # filename, password, language="English"
'open_wallet', # filename, password
'close_wallet',
'restore_deterministic_wallet', # name,password,seed (restore_height,language,seed_offset,autosave_current)
# filename,password,seed (restore_height,language,seed_offset,autosave_current)
'restore_deterministic_wallet',
'refresh', # start_height
)

View file

@ -292,7 +292,8 @@ class MoneroWalletOps:
Proxy: {blue(m[2] or 'None')}
""",strip_char='\t',indent=indent))
def post_main(self): pass
def post_main(self):
pass
def stop_daemons(self): pass
@ -384,7 +385,10 @@ class MoneroWalletOps:
len(self.addr_data),
os.path.basename(fn),
))
processed += await self.process_wallet(d,fn)
processed += await self.process_wallet(
d,
fn,
last = n == len(self.addr_data)-1 )
gmsg(f'\n{processed} wallet{suf(processed)} {self.past}')
return processed
@ -569,7 +573,7 @@ class MoneroWalletOps:
if int(uopt.restore_height) < 0:
die(1,f"{uopt.restore_height}: invalid value for --restore-height (less than zero)")
async def process_wallet(self,d,fn):
async def process_wallet(self,d,fn,last):
msg_r('') # for pexpect
from .baseconv import baseconv
@ -598,7 +602,7 @@ class MoneroWalletOps:
self.dc = MoneroRPCClientRaw(host=host, port=int(port), user=None, passwd=None)
self.accts_data = {}
async def process_wallet(self,d,fn):
async def process_wallet(self,d,fn,last):
chain_height = (await self.dc.call('get_height'))['height']
msg(f' Chain height: {chain_height}')

View file

@ -139,10 +139,12 @@ def joinpath(*args,**kwargs):
return os.path.join(*args,**kwargs)
def ok():
if opt.profile: return
if opt.profile:
return
if opt.verbose or opt.exact_output:
gmsg('OK')
else: msg(' OK')
else:
msg(' OK')
def cmp_or_die(s,t,desc=None):
if s != t:

View file

@ -29,6 +29,7 @@ def overlay_setup(repo_root):
make_link = os.symlink if sys.platform == 'linux' else shutil.copy2
if not os.path.exists(os.path.join(overlay_dir,'mmgen','main.py')):
sys.stderr.write('Setting up overlay tree\n')
for d in (
'mmgen',
'mmgen.data',

View file

@ -87,14 +87,14 @@ class TestSuiteXMRWallet(TestSuiteBase):
self.tx_relay_daemon_parm + f':127.0.0.1:{self.socks_port}' # proxy must be IP, not 'localhost'
if self.use_proxy else None )
if not opt.no_daemon_autostart:
self.start_daemons()
self.start_wallet_daemons()
if not opt.no_daemon_stop:
atexit.register(self.stop_daemons)
atexit.register(self.stop_wallet_daemons)
if not opt.no_daemon_autostart:
self.start_daemons()
self.start_wallet_daemons()
self.balance = None
# init methods

View file

@ -121,6 +121,13 @@ class unit_tests:
msg('OK')
return True
def status(self,name,ut):
msg_r('Checking status of coin daemons...')
qmsg('')
test_cmds('start')
msg('OK')
return True
def stop(self,name,ut):
msg_r('Stopping coin daemons...')
qmsg('')

View file

@ -116,7 +116,7 @@ class unit_tests:
MoneroWalletDaemon(
proto = proto,
test_suite = True,
wallet_dir = 'test/trash',
wallet_dir = 'test/trash2',
passwd = 'ut_rpc_passw0rd' )
) for proto in (init_proto('xmr',network=network) for network in networks) ]
@ -140,5 +140,8 @@ class unit_tests:
gmsg('OK')
import shutil
shutil.rmtree('test/trash2',ignore_errors=True)
os.makedirs('test/trash2')
run_session(run())
return True