Browse Source

rpc_init(): make `proto` a keyword parameter

The MMGen Project 1 year ago
parent
commit
bac47a6a0a
3 changed files with 5 additions and 3 deletions
  1. 1 1
      mmgen/main_txcreate.py
  2. 1 1
      mmgen/main_txdo.py
  3. 3 1
      mmgen/rpc.py

+ 1 - 1
mmgen/main_txcreate.py

@@ -87,7 +87,7 @@ async def main():
 	tx1 = await NewTX(cfg=cfg,proto=cfg._proto)
 
 	from .rpc import rpc_init
-	tx1.rpc = await rpc_init(cfg,cfg._proto)
+	tx1.rpc = await rpc_init(cfg)
 
 	tx2 = await tx1.create(
 		cmd_args = cfg._args,

+ 1 - 1
mmgen/main_txdo.py

@@ -135,7 +135,7 @@ async def main():
 	tx1 = await NewTX(cfg=cfg,proto=cfg._proto)
 
 	from .rpc import rpc_init
-	tx1.rpc = await rpc_init(cfg,cfg._proto)
+	tx1.rpc = await rpc_init(cfg)
 
 	tx2 = await tx1.create(
 		cmd_args = cfg._args,

+ 3 - 1
mmgen/rpc.py

@@ -448,12 +448,14 @@ class RPCClient(MMGenObject):
 
 async def rpc_init(
 		cfg,
-		proto,
+		proto                 = None,
 		backend               = None,
 		daemon                = None,
 		ignore_daemon_version = False,
 		ignore_wallet         = False ):
 
+	proto = proto or cfg._proto
+
 	if not 'rpc_init' in proto.mmcaps:
 		die(1,f'rpc_init() not supported for {proto.name} protocol!')