def start_node(i, dirname, extra_args=None, rpchost=None): """ Start a hivemindd and return RPC connection to it """ datadir = os.path.join(dirname, "node"+str(i)) args = [ os.getenv("HIVEMINDD", "hivemindd"), "-datadir="+datadir, "-keypool=1", "-discover=0", "-rest" ] if extra_args is not None: args.extend(extra_args) hivemindd_processes[i] = subprocess.Popen(args) devnull = open("/dev/null", "w+") subprocess.check_call([ os.getenv("HIVEMINDCLI", "hivemind-cli"), "-datadir="+datadir] + _rpchost_to_args(rpchost) + ["-rpcwait", "getblockcount"], stdout=devnull) devnull.close() url = "http://*****:*****@%s:%d" % (rpchost or '127.0.0.1', rpc_port(i)) proxy = AuthServiceProxy(url) proxy.url = url # store URL on proxy for info return proxy
def start_node(i, dirname, extra_args=None, rpchost=None): """ Start a hivemindd and return RPC connection to it """ datadir = os.path.join(dirname, "node" + str(i)) args = [ os.getenv("HIVEMINDD", "hivemindd"), "-datadir=" + datadir, "-keypool=1", "-discover=0", "-rest" ] if extra_args is not None: args.extend(extra_args) hivemindd_processes[i] = subprocess.Popen(args) devnull = open("/dev/null", "w+") subprocess.check_call( [os.getenv("HIVEMINDCLI", "hivemind-cli"), "-datadir=" + datadir] + _rpchost_to_args(rpchost) + ["-rpcwait", "getblockcount"], stdout=devnull) devnull.close() url = "http://*****:*****@%s:%d" % (rpchost or '127.0.0.1', rpc_port(i)) proxy = AuthServiceProxy(url) proxy.url = url # store URL on proxy for info return proxy