From bac47a6a0addabe4071ced679a29fbd143033b23 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Tue, 4 Apr 2023 16:04:13 +0000 Subject: [PATCH] rpc_init(): make `proto` a keyword parameter --- mmgen/main_txcreate.py | 2 +- mmgen/main_txdo.py | 2 +- mmgen/rpc.py | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mmgen/main_txcreate.py b/mmgen/main_txcreate.py index 3ae939c6..eb8ab43a 100755 --- a/mmgen/main_txcreate.py +++ b/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, diff --git a/mmgen/main_txdo.py b/mmgen/main_txdo.py index 53dcedbb..06dcbabf 100755 --- a/mmgen/main_txdo.py +++ b/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, diff --git a/mmgen/rpc.py b/mmgen/rpc.py index 753872b7..f39d87e4 100755 --- a/mmgen/rpc.py +++ b/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!')