Browse Source

rpc: fix rpc host/credentials for regtest

The MMGen Project 1 year ago
parent
commit
0883b36842
1 changed files with 5 additions and 2 deletions
  1. 5 2
      mmgen/proto/btc/rpc.py

+ 5 - 2
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()