From b45e1671e91c6d78471a25496c8d8519f42336d0 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Thu, 4 May 2023 18:13:53 +0000 Subject: [PATCH] mmgen-xmrwallet: remove --wallet-rpc-host option --- mmgen/cfg.py | 2 -- mmgen/data/mmgen.cfg | 3 --- mmgen/main_xmrwallet.py | 1 - mmgen/proto/xmr/daemon.py | 6 +----- mmgen/proto/xmr/rpc.py | 8 ++++---- mmgen/tool/rpc.py | 2 +- mmgen/xmrwallet.py | 4 ++-- test/test_py_d/ts_xmrwallet.py | 2 +- test/unit_tests_d/ut_rpc.py | 2 +- 9 files changed, 10 insertions(+), 20 deletions(-) diff --git a/mmgen/cfg.py b/mmgen/cfg.py index acac8383..0b84eb35 100755 --- a/mmgen/cfg.py +++ b/mmgen/cfg.py @@ -161,7 +161,6 @@ class Config(Lockable): rpc_port = 0 rpc_user = '' rpc_password = '' - monero_wallet_rpc_host = 'localhost' monero_wallet_rpc_user = 'monero' monero_wallet_rpc_password = '' aiohttp_rpc_queue_len = 16 @@ -249,7 +248,6 @@ class Config(Lockable): 'max_input_size', 'max_tx_file_size', 'mnemonic_entry_modes', - 'monero_wallet_rpc_host', 'monero_wallet_rpc_password', 'monero_wallet_rpc_user', 'no_license', diff --git a/mmgen/data/mmgen.cfg b/mmgen/data/mmgen.cfg index d30c09bb..55ad2ead 100644 --- a/mmgen/data/mmgen.cfg +++ b/mmgen/data/mmgen.cfg @@ -125,9 +125,6 @@ # Set the Ethereum testnet chain names (space-separated list, first is default): # eth_testnet_chain_names kovan -# Set the Monero wallet RPC host: -# monero_wallet_rpc_host localhost - # Set the Monero wallet RPC username: # monero_wallet_rpc_user monero diff --git a/mmgen/main_xmrwallet.py b/mmgen/main_xmrwallet.py index 6e4b1a40..5b115b72 100755 --- a/mmgen/main_xmrwallet.py +++ b/mmgen/main_xmrwallet.py @@ -84,7 +84,6 @@ opts_data = { -W, --watch-only Create or operate on watch-only wallets -w, --wallet-dir=D Output or operate on wallets in directory 'D' instead of the working directory --H, --wallet-rpc-host=host Wallet RPC hostname (currently: {cfg.monero_wallet_rpc_host!r}) -U, --wallet-rpc-user=user Wallet RPC username (currently: {cfg.monero_wallet_rpc_user!r}) -P, --wallet-rpc-password=pass Wallet RPC password (currently: [scrubbed]) """, diff --git a/mmgen/proto/xmr/daemon.py b/mmgen/proto/xmr/daemon.py index 48ac6b21..9e1c0e81 100755 --- a/mmgen/proto/xmr/daemon.py +++ b/mmgen/proto/xmr/daemon.py @@ -24,7 +24,6 @@ class monero_daemon(CoinDaemon): exec_fn = 'monerod' testnet_dir = 'stagenet' new_console_mswin = True - host = 'localhost' # FIXME rpc_ports = _nw(18081, 38081, None) # testnet is stagenet cfg_file = 'bitmonero.conf' datadirs = { @@ -47,7 +46,7 @@ class monero_daemon(CoinDaemon): self.rpc = MoneroRPCClient( cfg = self.cfg, proto = self.proto, - host = self.host, + host = 'localhost', port = self.rpc_port, user = None, passwd = None, @@ -96,7 +95,6 @@ class MoneroWalletDaemon(RPCDaemon): proto, wallet_dir, test_suite = False, - host = None, user = None, passwd = None, daemon_addr = None, @@ -131,11 +129,9 @@ class MoneroWalletDaemon(RPCDaemon): test_suite = test_suite).rpc_port ) - self.host = host or self.cfg.wallet_rpc_host or self.cfg.monero_wallet_rpc_host 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 - assert self.host assert self.user if not self.passwd: die(1, diff --git a/mmgen/proto/xmr/rpc.py b/mmgen/proto/xmr/rpc.py index 54a47d2f..53d2c0a1 100755 --- a/mmgen/proto/xmr/rpc.py +++ b/mmgen/proto/xmr/rpc.py @@ -103,10 +103,10 @@ class MoneroWalletRPCClient(MoneroRPCClient): def __init__(self,cfg,daemon,test_connection=True): RPCClient.__init__( - self, - cfg, - daemon.host, - daemon.rpc_port, + self = self, + cfg = cfg, + host = 'localhost', + port = daemon.rpc_port, test_connection = test_connection ) self.daemon = daemon diff --git a/mmgen/tool/rpc.py b/mmgen/tool/rpc.py index 219408c2..b40d9f4e 100755 --- a/mmgen/tool/rpc.py +++ b/mmgen/tool/rpc.py @@ -40,7 +40,7 @@ class tool_cmd(tool_cmd_base): cfg = self.cfg, proto = self.proto, daemon = d, - host = d.host, + host = 'localhost', port = d.rpc_port, user = None, passwd = None, diff --git a/mmgen/xmrwallet.py b/mmgen/xmrwallet.py index 099c484b..2b71013c 100755 --- a/mmgen/xmrwallet.py +++ b/mmgen/xmrwallet.py @@ -1807,7 +1807,7 @@ class MoneroWalletOps: else: from .daemon import CoinDaemon md = CoinDaemon( self.cfg, 'xmr', test_suite=self.cfg.test_suite ) - host,port = md.host,md.rpc_port + host,port = ('localhost', md.rpc_port) proxy = None self.dc = MoneroRPCClient( @@ -1818,7 +1818,7 @@ class MoneroWalletOps: port = int(port), user = None, passwd = None, - test_connection = False, # relay is presumably a public node, so avoid extra connections + test_connection = host == 'localhost', # avoid extra connections if relay is a public node proxy = proxy ) async def main(self): diff --git a/test/test_py_d/ts_xmrwallet.py b/test/test_py_d/ts_xmrwallet.py index 5549025e..8b86baa3 100755 --- a/test/test_py_d/ts_xmrwallet.py +++ b/test/test_py_d/ts_xmrwallet.py @@ -243,7 +243,7 @@ class TestSuiteXMRWallet(TestSuiteBase): md_rpc = MoneroRPCClient( cfg = cfg, proto = self.proto, - host = md.host, + host = 'localhost', port = md.rpc_port, user = None, passwd = None, diff --git a/test/unit_tests_d/ut_rpc.py b/test/unit_tests_d/ut_rpc.py index 0e63be20..59180b4e 100755 --- a/test/unit_tests_d/ut_rpc.py +++ b/test/unit_tests_d/ut_rpc.py @@ -172,7 +172,7 @@ class unit_tests: rpc = MoneroRPCClient( cfg = cfg, proto = md.proto, - host = md.host, + host = 'localhost', port = md.rpc_port, user = None, passwd = None,