autosign: restart Monero wallet daemon only when necessary
This commit is contained in:
parent
08319227c5
commit
f004e50df9
3 changed files with 19 additions and 9 deletions
|
|
@ -128,6 +128,11 @@ class Signable:
|
|||
|
||||
class xmr_signable(transaction): # virtual class
|
||||
|
||||
def need_daemon_restart(self,new_idx):
|
||||
old_idx = self.parent.xmr_cur_wallet_idx
|
||||
self.parent.xmr_cur_wallet_idx = new_idx
|
||||
return old_idx != new_idx
|
||||
|
||||
def print_summary(self,signables):
|
||||
bmsg('\nAutosign summary:')
|
||||
msg(
|
||||
|
|
@ -153,7 +158,7 @@ class Signable:
|
|||
wallets = str(tx1.src_wallet_idx),
|
||||
spec = None ),
|
||||
)
|
||||
tx2 = await m.main(f) # TODO: stop wallet daemon?
|
||||
tx2 = await m.main( f, restart_daemon=self.need_daemon_restart(tx1.src_wallet_idx) )
|
||||
tx2.write(ask_write=False)
|
||||
return tx2
|
||||
|
||||
|
|
@ -176,7 +181,7 @@ class Signable:
|
|||
wallets = str(wallet_idx),
|
||||
spec = None ),
|
||||
)
|
||||
obj = await m.main( f, wallet_idx )
|
||||
obj = await m.main( f, wallet_idx, restart_daemon=self.need_daemon_restart(wallet_idx) )
|
||||
obj.write()
|
||||
return obj
|
||||
|
||||
|
|
@ -282,6 +287,7 @@ class Autosign:
|
|||
self.xmr_dir = self.mountpoint / 'xmr'
|
||||
self.xmr_tx_dir = self.mountpoint / 'xmr' / 'tx'
|
||||
self.xmr_outputs_dir = self.mountpoint / 'xmr' / 'outputs'
|
||||
self.xmr_cur_wallet_idx = None
|
||||
|
||||
async def check_daemons_running(self):
|
||||
from .protocol import init_proto
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
13.3.dev51
|
||||
13.3.dev52
|
||||
|
|
|
|||
|
|
@ -1637,12 +1637,14 @@ class MoneroWalletOps:
|
|||
start_daemon = False
|
||||
offline = True
|
||||
|
||||
async def main(self,fn):
|
||||
await self.restart_wallet_daemon()
|
||||
async def main(self,fn,restart_daemon=True):
|
||||
if restart_daemon:
|
||||
await self.restart_wallet_daemon()
|
||||
tx = MoneroMMGenTX.Unsigned( self.cfg, fn )
|
||||
h = self.rpc(self,self.addr_data[0])
|
||||
self.head_msg(tx.src_wallet_idx,h.fn)
|
||||
h.open_wallet()
|
||||
if restart_daemon:
|
||||
h.open_wallet()
|
||||
res = self.c.call(
|
||||
'sign_transfer',
|
||||
unsigned_txset = tx.data.unsigned_txset,
|
||||
|
|
@ -1821,11 +1823,13 @@ class MoneroWalletOps:
|
|||
start_daemon = False
|
||||
offline = True
|
||||
|
||||
async def main(self,fn,wallet_idx):
|
||||
await self.restart_wallet_daemon()
|
||||
async def main(self,fn,wallet_idx,restart_daemon=True):
|
||||
if restart_daemon:
|
||||
await self.restart_wallet_daemon()
|
||||
h = self.rpc(self,self.addr_data[0])
|
||||
self.head_msg(wallet_idx,fn)
|
||||
h.open_wallet()
|
||||
if restart_daemon:
|
||||
h.open_wallet()
|
||||
m = MoneroWalletOutputsFile.Unsigned(
|
||||
parent = self,
|
||||
fn = fn )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue