rpc: fix rpc host/credentials for regtest

This commit is contained in:
The MMGen Project 2024-03-06 11:05:21 +00:00
commit 0883b36842
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2

View file

@ -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()