mmgen-regtest: add 'start' command
This commit is contained in:
parent
46aa2ea953
commit
02a71f7443
2 changed files with 13 additions and 2 deletions
|
|
@ -41,6 +41,7 @@ opts_data = {
|
|||
AVAILABLE COMMANDS
|
||||
|
||||
setup - set up Bob and Alice regtest mode
|
||||
start - start the regtest coin daemon
|
||||
stop - stop the regtest coin daemon
|
||||
bob - switch to Bob's wallet, starting daemon if necessary
|
||||
alice - switch to Alice's wallet, starting daemon if necessary
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class MMGenRegtest(MMGenObject):
|
|||
rpc_password = 'hodltothemoon'
|
||||
users = ('bob','alice','miner')
|
||||
coins = ('btc','bch','ltc')
|
||||
usr_cmds = ('setup','generate','send','stop', 'state', 'balances','mempool','cli')
|
||||
usr_cmds = ('setup','generate','send','start','stop', 'state', 'balances','mempool','cli')
|
||||
|
||||
def __init__(self,coin):
|
||||
self.coin = coin.lower()
|
||||
|
|
@ -136,8 +136,18 @@ class MMGenRegtest(MMGenObject):
|
|||
rpc = await rpc_init(self.proto,backend=None,daemon=self.d)
|
||||
return await rpc.call(*args,wallet=wallet)
|
||||
|
||||
async def start(self):
|
||||
if self.d.state == 'stopped':
|
||||
await self.start_daemon(silent=False)
|
||||
else:
|
||||
msg(f'{g.coin} regtest daemon already started')
|
||||
|
||||
async def stop(self):
|
||||
await self.rpc_call('stop')
|
||||
if self.d.state == 'stopped':
|
||||
msg(f'{g.coin} regtest daemon already stopped')
|
||||
else:
|
||||
msg(f'Stopping {g.coin} regtest daemon')
|
||||
await self.rpc_call('stop',start_daemon=False)
|
||||
|
||||
def state(self):
|
||||
msg(self.d.state)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue