Browse Source

remove global --monero-wallet-rpc-{host,user,password} options

- they're replaced by the corresponding --wallet-rpc-* options in
  `mmgen-xmrwallet`
The MMGen Project 3 years ago
parent
commit
cf28abc46d
5 changed files with 15 additions and 16 deletions
  1. 6 6
      mmgen/daemon.py
  2. 1 2
      mmgen/globalvars.py
  3. 3 0
      mmgen/main_xmrwallet.py
  4. 0 3
      mmgen/opts.py
  5. 5 5
      test/test_py_d/ts_xmrwallet.py

+ 6 - 6
mmgen/daemon.py

@@ -283,18 +283,18 @@ class MoneroWalletDaemon(RPCDaemon):
 		self.daemon_addr = daemon_addr
 		self.daemon_port = None if daemon_addr else CoinDaemon(proto=proto,test_suite=test_suite).rpc_port
 
-		self.host = host or g.monero_wallet_rpc_host
-		self.user = user or g.monero_wallet_rpc_user
-		self.passwd = passwd or g.monero_wallet_rpc_password
+		self.host = host or opt.wallet_rpc_host or g.monero_wallet_rpc_host
+		self.user = user or opt.wallet_rpc_user or g.monero_wallet_rpc_user
+		self.passwd = passwd or opt.wallet_rpc_password or g.monero_wallet_rpc_password
 
 		assert self.host
 		assert self.user
 		if not self.passwd:
 			die(1,
 				'You must set your Monero wallet RPC password.\n' +
-				'This can be done on the command line, with the --monero-wallet-rpc-password\n' +
-				"option (insecure, not recommended), or by setting 'monero_wallet_rpc_password'\n" +
-				"in the MMGen config file." )
+				'This can be done on the command line with the --wallet-rpc-password option\n' +
+				"(insecure, not recommended), or by setting 'monero_wallet_rpc_password' in\n" +
+				"the MMGen config file." )
 
 		self.daemon_args = list_gen(
 			['--untrusted-daemon'],

+ 1 - 2
mmgen/globalvars.py

@@ -160,11 +160,10 @@ class GlobalContext(Lockable):
 	# user opt sets global var:
 	opt_sets_global = ( 'cached_balances', )
 
-	# 'long' opts - opt sets global var
+	# 'long' opts - opt sets global var (see common_opts_data)
 	common_opts = (
 		'color','no_license','testnet',
 		'rpc_host','rpc_port','rpc_user','rpc_password','rpc_backend','aiohttp_rpc_queue_len',
-		'monero_wallet_rpc_host','monero_wallet_rpc_user','monero_wallet_rpc_password',
 		'daemon_data_dir','force_256_color','regtest','coin','bob','alice',
 		'accept_defaults','token','ignore_daemon_version','daemon_id','http_timeout',
 	)

+ 3 - 0
mmgen/main_xmrwallet.py

@@ -54,6 +54,9 @@ opts_data = {
 -S, --no-stop-wallet-daemon      Don’t stop the wallet daemon at exit
 -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 (default: {g.monero_wallet_rpc_host!r})
+-U, --wallet-rpc-user=user       Wallet RPC username (default: {g.monero_wallet_rpc_user!r})
+-P, --wallet-rpc-password=pass   Wallet RPC password (default: {g.monero_wallet_rpc_password!r})
 """,
 	'notes': """
 

+ 0 - 3
mmgen/opts.py

@@ -198,9 +198,6 @@ common_opts_data = {
 --, --rpc-password=pass    Authenticate to {dn} using password 'pass'
 --, --rpc-backend=backend  Use backend 'backend' for JSON-RPC communications
 --, --aiohttp-rpc-queue-len=N Use 'N' simultaneous RPC connections with aiohttp
---, --monero-wallet-rpc-host=host  Specify Monero wallet daemon host
---, --monero-wallet-rpc-user=user  Specify Monero wallet daemon username
---, --monero-wallet-rpc-password=pass  Specify Monero wallet daemon password
 --, --regtest=0|1          Disable or enable regtest mode
 --, --testnet=0|1          Disable or enable testnet
 --, --skip-cfg-file        Skip reading the configuration file

+ 5 - 5
test/test_py_d/ts_xmrwallet.py

@@ -74,7 +74,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
 		from mmgen.protocol import init_proto
 		self.proto = init_proto('XMR',network='testnet')
 		self.datadir_base  = os.path.join('test','daemons','xmrtest')
-		self.long_opts = ['--testnet=1', '--monero-wallet-rpc-password=passw0rd']
+		self.extra_opts = ['--testnet=1', '--wallet-rpc-password=passw0rd']
 		self.init_users()
 		self.init_daemon_args()
 
@@ -298,7 +298,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
 		dir_opt = [f'--wallet-dir={data.udir}']
 		t = self.spawn(
 			'mmgen-xmrwallet',
-			self.long_opts + dir_opt + [ 'create', data.kafile, (wallet or data.kal_range) ] )
+			self.extra_opts + dir_opt + [ 'create', data.kafile, (wallet or data.kal_range) ] )
 		t.expect('Check key-to-address validity? (y/N): ','n')
 		for i in MMGenRange(wallet or data.kal_range).items:
 			t.expect('Address: ')
@@ -336,7 +336,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
 		)
 		t = self.spawn(
 			'mmgen-xmrwallet',
-			self.long_opts + cmd_opts + (add_opts or []) + [ 'sync', data.kafile ] + ([wallets] if wallets else []) )
+			self.extra_opts + cmd_opts + (add_opts or []) + [ 'sync', data.kafile ] + ([wallets] if wallets else []) )
 		t.expect('Check key-to-address validity? (y/N): ','n')
 		wlist = AddrIdxList(wallets) if wallets else MMGenRange(data.kal_range).items
 		for n,wnum in enumerate(wlist):
@@ -371,7 +371,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
 
 		t = self.spawn(
 			'mmgen-xmrwallet',
-			self.long_opts + cmd_opts + [ op, data.kafile, arg2 ],
+			self.extra_opts + cmd_opts + [ op, data.kafile, arg2 ],
 			extra_desc = f'({capfirst(user)}{add_desc})' )
 
 		t.expect('Check key-to-address validity? (y/N): ','n')
@@ -444,7 +444,7 @@ class TestSuiteXMRWallet(TestSuiteBase):
 		add_desc = (', ' + add_desc) if add_desc else ''
 		t = self.spawn(
 			'mmgen-xmrwallet',
-			self.long_opts
+			self.extra_opts
 			+ ([relay_opt] if relay_opt else [])
 			+ [ 'relay', fn ],
 			extra_desc = f'(relaying TX, {capfirst(user)}{add_desc})' )