Start a node with rpcallow IP, and request getnetworkinfo at a non-localhost IP.
(self, allow_ips, rpchost, rpcport)
| 58 | self.nodes[0].assert_start_raises_init_error(base_args + [f'-rpcbind={addr}'], init_error + f"'{addr}'") |
| 59 | |
| 60 | def run_allowip_test(self, allow_ips, rpchost, rpcport): |
| 61 | ''' |
| 62 | Start a node with rpcallow IP, and request getnetworkinfo |
| 63 | at a non-localhost IP. |
| 64 | ''' |
| 65 | self.log.info("Allow IP test for %s:%d" % (rpchost, rpcport)) |
| 66 | node_args = \ |
| 67 | ['-disablewallet', '-nolisten'] + \ |
| 68 | ['-rpcallowip='+x for x in allow_ips] + \ |
| 69 | ['-rpcbind='+addr for addr in ['127.0.0.1', "%s:%d" % (rpchost, rpcport)]] # Bind to localhost as well so start_nodes doesn't hang |
| 70 | self.nodes[0].rpchost = None |
| 71 | self.start_nodes([node_args]) |
| 72 | self.nodes[0].rpchost = f"{rpchost}:{rpcport}" |
| 73 | # connect to node through non-loopback interface |
| 74 | node = self.nodes[0].create_new_rpc_connection() |
| 75 | node.getnetworkinfo() |
| 76 | self.stop_nodes() |
| 77 | |
| 78 | def run_invalid_allowip_test(self): |
| 79 | ''' |
no test coverage detected