Browse Source

xmrwallet.ops: `relay` -> `daemon`

The MMGen Project 1 day ago
parent
commit
8f269f1553
2 changed files with 13 additions and 6 deletions
  1. 2 1
      mmgen/xmrwallet/__init__.py
  2. 11 5
      mmgen/xmrwallet/ops/daemon.py

+ 2 - 1
mmgen/xmrwallet/__init__.py

@@ -55,7 +55,8 @@ op_names = {
 	'transfer':            'sweep',
 	'transfer':            'sweep',
 	'sweep':               'sweep',
 	'sweep':               'sweep',
 	'sweep_all':           'sweep',
 	'sweep_all':           'sweep',
-	'relay':               'relay',
+	'daemon':              'daemon',
+	'relay':               'daemon',
 	'txview':              'txview',
 	'txview':              'txview',
 	'txlist':              'txview',
 	'txlist':              'txview',
 	'label':               'label',
 	'label':               'label',

+ 11 - 5
mmgen/xmrwallet/ops/relay.py → mmgen/xmrwallet/ops/daemon.py

@@ -9,7 +9,7 @@
 #   https://gitlab.com/mmgen/mmgen-wallet
 #   https://gitlab.com/mmgen/mmgen-wallet
 
 
 """
 """
-xmrwallet.ops.relay: Monero wallet ops for the MMGen Suite
+xmrwallet.ops.daemon: Monero wallet ops for the MMGen Suite
 """
 """
 
 
 import time
 import time
@@ -23,7 +23,7 @@ from ..file.tx import MoneroMMGenTX
 
 
 from . import OpBase
 from . import OpBase
 
 
-class OpRelay(OpBase):
+class OpDaemon(OpBase):
 	opts = ('tx_relay_daemon',)
 	opts = ('tx_relay_daemon',)
 
 
 	def __init__(self, cfg, uarg_tuple):
 	def __init__(self, cfg, uarg_tuple):
@@ -32,8 +32,6 @@ class OpRelay(OpBase):
 
 
 		self.mount_removable_device()
 		self.mount_removable_device()
 
 
-		self.tx = MoneroMMGenTX.Signed(self.cfg, Path(self.uargs.infile))
-
 		if self.cfg.tx_relay_daemon:
 		if self.cfg.tx_relay_daemon:
 			m = self.parse_tx_relay_opt()
 			m = self.parse_tx_relay_opt()
 			host, port = m[1].split(':')
 			host, port = m[1].split(':')
@@ -42,7 +40,9 @@ class OpRelay(OpBase):
 		else:
 		else:
 			from ...daemon import CoinDaemon
 			from ...daemon import CoinDaemon
 			md = CoinDaemon(self.cfg, network_id='xmr', test_suite=self.cfg.test_suite)
 			md = CoinDaemon(self.cfg, network_id='xmr', test_suite=self.cfg.test_suite)
-			host, port = ('localhost', md.rpc_port)
+			host, port = (
+				self.cfg.daemon.split(':') if self.cfg.daemon else
+				('localhost', md.rpc_port))
 			proxy = None
 			proxy = None
 
 
 		self.dc = MoneroRPCClient(
 		self.dc = MoneroRPCClient(
@@ -56,6 +56,12 @@ class OpRelay(OpBase):
 			test_connection = host == 'localhost', # avoid extra connections if relay is a public node
 			test_connection = host == 'localhost', # avoid extra connections if relay is a public node
 			proxy  = proxy)
 			proxy  = proxy)
 
 
+class OpRelay(OpDaemon):
+
+	def __init__(self, cfg, uarg_tuple):
+		super().__init__(cfg, uarg_tuple)
+		self.tx = MoneroMMGenTX.Signed(self.cfg, Path(self.uargs.infile))
+
 	async def main(self):
 	async def main(self):
 		msg('\n' + self.tx.get_info(indent='    '))
 		msg('\n' + self.tx.get_info(indent='    '))