MCPcopy Create free account
hub / github.com/ElementsProject/elements / run_allowip_test

Method run_allowip_test

test/functional/rpc_bind.py:46–61  ·  view source on GitHub ↗

Start a node with rpcallow IP, and request getnetworkinfo at a non-localhost IP.

(self, allow_ips, rpchost, rpcport)

Source from the content-addressed store, hash-verified

44 self.stop_nodes()
45
46 def run_allowip_test(self, allow_ips, rpchost, rpcport):
47 '''
48 Start a node with rpcallow IP, and request getnetworkinfo
49 at a non-localhost IP.
50 '''
51 self.log.info("Allow IP test for %s:%d" % (rpchost, rpcport))
52 node_args = \
53 ['-disablewallet', '-nolisten'] + \
54 ['-rpcallowip='+x for x in allow_ips] + \
55 ['-rpcbind='+addr for addr in ['127.0.0.1', "%s:%d" % (rpchost, rpcport)]] # Bind to localhost as well so start_nodes doesn't hang
56 self.nodes[0].rpchost = None
57 self.start_nodes([node_args])
58 # connect to node through non-loopback interface
59 node = get_rpc_proxy(rpc_url(self.nodes[0].datadir, 0, self.chain, "%s:%d" % (rpchost, rpcport)), 0, coveragedir=self.options.coveragedir)
60 node.getnetworkinfo()
61 self.stop_nodes()
62
63 def run_test(self):
64 # due to OS-specific network stats queries, this test works only on Linux

Callers 1

Calls 5

get_rpc_proxyFunction · 0.90
rpc_urlFunction · 0.90
infoMethod · 0.80
start_nodesMethod · 0.45
stop_nodesMethod · 0.45

Tested by

no test coverage detected