MoneroWalletDaemon: new test_monerod param

This commit is contained in:
The MMGen Project 2023-05-04 18:36:14 +00:00
commit 1a35af9983
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 14 additions and 1 deletions

View file

@ -101,7 +101,8 @@ class MoneroWalletDaemon(RPCDaemon):
proxy = None,
port_shift = None,
datadir = None,
trust_monerod = False ):
trust_monerod = False,
test_monerod = False ):
self.proto = proto
self.test_suite = test_suite
@ -129,6 +130,13 @@ class MoneroWalletDaemon(RPCDaemon):
test_suite = test_suite).rpc_port
)
if test_monerod and self.monerod_port:
import socket
try:
socket.create_connection(('localhost',self.monerod_port),timeout=1).close()
except:
die( 'SocketError', f'Unable to connect to Monero daemon at localhost:{self.monerod_port}' )
self.user = user or self.cfg.wallet_rpc_user or self.cfg.monero_wallet_rpc_user
self.passwd = passwd or self.cfg.wallet_rpc_password or self.cfg.monero_wallet_rpc_password

View file

@ -732,6 +732,7 @@ class MoneroWalletOps:
start_daemon = True
offline = False
skip_wallet_check = False # for debugging
test_monerod = False
def __init__(self,cfg,uarg_tuple):
@ -798,6 +799,7 @@ class MoneroWalletOps:
test_suite = self.cfg.test_suite,
monerod_addr = relay_opt[1] if relay_opt else (self.cfg.daemon or None),
trust_monerod = self.trust_monerod,
test_monerod = self.test_monerod,
)
u = self.wd.usr_daemon_args = []
@ -1266,6 +1268,7 @@ class MoneroWalletOps:
class sync(wallet):
opts = ('rescan_blockchain',)
test_monerod = True
def __init__(self,cfg,uarg_tuple):
@ -1430,6 +1433,7 @@ class MoneroWalletOps:
spec_id = 'sweep_spec'
spec_key = ( (1,'source'), (3,'dest') )
opts = ('no_relay','tx_relay_daemon','watch_only')
test_monerod = True
def check_uopts(self):
if self.cfg.tx_relay_daemon and (self.cfg.no_relay or self.cfg.autosign):
@ -1655,6 +1659,7 @@ class MoneroWalletOps:
class submit(wallet):
action = 'submitting transaction with'
opts = ('tx_relay_daemon',)
test_monerod = True
def check_uopts(self):
if self.cfg.daemon: