From 0883b3684253384043a3c9d62302c1f6532ffebb Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Wed, 6 Mar 2024 11:05:21 +0000 Subject: [PATCH] rpc: fix rpc host/credentials for regtest --- mmgen/proto/btc/rpc.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mmgen/proto/btc/rpc.py b/mmgen/proto/btc/rpc.py index de77a52f..33b08ebe 100755 --- a/mmgen/proto/btc/rpc.py +++ b/mmgen/proto/btc/rpc.py @@ -117,7 +117,7 @@ class BitcoinRPCClient(RPCClient,metaclass=AsyncInit): super().__init__( cfg = cfg, - host = 'localhost' if cfg.test_suite else (cfg.rpc_host or 'localhost'), + host = 'localhost' if cfg.test_suite or cfg.network == 'regtest' else (cfg.rpc_host or 'localhost'), port = daemon.rpc_port ) self.set_auth() @@ -194,7 +194,10 @@ class BitcoinRPCClient(RPCClient,metaclass=AsyncInit): """ MMGen's credentials override coin daemon's """ - if self.cfg.rpc_user: + if self.cfg.network == 'regtest': + from .regtest import MMGenRegtest + user,passwd = (MMGenRegtest.rpc_user, MMGenRegtest.rpc_password) + elif self.cfg.rpc_user: user,passwd = (self.cfg.rpc_user,self.cfg.rpc_password) else: user,passwd = self.get_daemon_cfg_options(('rpcuser','rpcpassword')).values()