Browse Source

txcreate, txdo: delay RPC initialization

The MMGen Project 3 weeks ago
parent
commit
9a963e1488
3 changed files with 2 additions and 6 deletions
  1. 0 3
      mmgen/main_txcreate.py
  2. 0 3
      mmgen/main_txdo.py
  3. 2 0
      mmgen/tx/new.py

+ 0 - 3
mmgen/main_txcreate.py

@@ -112,9 +112,6 @@ async def main():
 	from .tx import NewTX
 	tx1 = await NewTX(cfg=cfg, proto=cfg._proto, target=target)
 
-	from .rpc import rpc_init
-	tx1.rpc = await rpc_init(cfg)
-
 	tx2 = await tx1.create(
 		cmd_args = cfg._args,
 		locktime = int(cfg.locktime or 0),

+ 0 - 3
mmgen/main_txdo.py

@@ -153,9 +153,6 @@ async def main():
 
 	tx1 = await NewTX(cfg=cfg, proto=cfg._proto, target=target)
 
-	from .rpc import rpc_init
-	tx1.rpc = await rpc_init(cfg)
-
 	tx2 = await tx1.create(
 		cmd_args = cfg._args,
 		locktime = int(cfg.locktime or 0),

+ 2 - 0
mmgen/tx/new.py

@@ -418,6 +418,8 @@ class New(Base):
 			if self.target == 'swaptx':
 				# updates self.proto!
 				self.proto, cmd_args = await self.process_swap_cmdline_args(cmd_args, addrfile_args)
+			from ..rpc import rpc_init
+			self.rpc = await rpc_init(self.cfg, self.proto)
 			from ..addrdata import TwAddrData
 			await self.process_cmdline_args(
 				cmd_args,