xmrwallet, proto.xmr.daemon: minor changes
This commit is contained in:
parent
12a1986e26
commit
60a201e112
3 changed files with 16 additions and 5 deletions
|
|
@ -16,7 +16,7 @@ import os
|
|||
|
||||
from ...globalvars import g
|
||||
from ...opts import opt
|
||||
from ...util import list_gen,die
|
||||
from ...util import list_gen,die,contains_any
|
||||
from ...daemon import CoinDaemon,RPCDaemon,_nw,_dd
|
||||
|
||||
class monero_daemon(CoinDaemon):
|
||||
|
|
@ -74,7 +74,7 @@ class monero_daemon(CoinDaemon):
|
|||
def stop_cmd(self):
|
||||
if self.platform == 'win':
|
||||
return ['kill','-Wf',self.pid]
|
||||
elif '--restricted-rpc' in self.start_cmd or '--public-node' in self.start_cmd:
|
||||
elif contains_any( self.start_cmd, ['--restricted-rpc','--public-node'] ):
|
||||
return ['kill',self.pid]
|
||||
else:
|
||||
return [self.exec_fn] + self.shared_args + ['exit']
|
||||
|
|
|
|||
|
|
@ -189,6 +189,9 @@ def remove_dups(iterable,edesc='element',desc='list',quiet=False,hide=False):
|
|||
ret.append(e)
|
||||
return ret if type(iterable).__name__ == 'generator' else type(iterable)(ret)
|
||||
|
||||
def contains_any(target_list,source_list):
|
||||
return any(map(target_list.count,source_list))
|
||||
|
||||
def suf(arg,suf_type='s',verb='none'):
|
||||
suf_types = {
|
||||
'none': {
|
||||
|
|
|
|||
|
|
@ -775,11 +775,19 @@ class MoneroWalletOps:
|
|||
self.addr_data = list(gen())
|
||||
self.account = None if m[2] is None else int(m[2])
|
||||
|
||||
def strip_quotes(s):
|
||||
if s and s[0] in ("'",'"'):
|
||||
if s[-1] != s[0] or len(s) < 2:
|
||||
die(1,f'{s!r}: unbalanced quotes in label string!')
|
||||
return s[1:-1]
|
||||
else:
|
||||
return s # None or empty string
|
||||
|
||||
if self.name == 'transfer':
|
||||
self.dest_addr = CoinAddr(self.proto,m[3])
|
||||
self.amount = self.proto.coin_amt(m[4])
|
||||
elif self.name == 'new':
|
||||
self.label = m[3]
|
||||
self.label = strip_quotes(m[3])
|
||||
|
||||
class sweep(spec):
|
||||
name = 'sweep'
|
||||
|
|
@ -883,8 +891,7 @@ class MoneroWalletOps:
|
|||
h.open_wallet(w_desc,refresh=False)
|
||||
msg_r(f'\n Relaying {self.name} transaction...')
|
||||
h.relay_tx(new_tx.data.metadata)
|
||||
|
||||
gmsg('\n\nAll done')
|
||||
gmsg('\nAll done')
|
||||
else:
|
||||
die(1,'\nExiting at user request')
|
||||
|
||||
|
|
@ -950,6 +957,7 @@ class MoneroWalletOps:
|
|||
port = int(port),
|
||||
user = None,
|
||||
passwd = None,
|
||||
test_connection = False, # relay is presumably a public node, so avoid extra connections
|
||||
proxy = proxy )
|
||||
|
||||
self.tx = MoneroMMGenTX.Signed(uarg.infile)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue