Skip to content

Commit

Permalink
Merge bitcoin#14861: tests: Modify rpc_bind to conform to bitcoin#14532
Browse files Browse the repository at this point in the history
… behaviour.

f3cf95f tests: Modify rpc_bind to conform to bitcoin#14532 behaviour. (Carl Dong)

Pull request description:

  Fixes: bitcoin#14792

Tree-SHA512: 5ee63a06c92dae5406515e9e483188309b82e07b760f363d8c8ec46a42fe5f75f88724759b0ac8ef596ee28a135626e0582f575855c5dfec2fbfff2249a109f7
  • Loading branch information
laanwj authored and UdjinM6 committed Jul 9, 2020
1 parent f5c91d1 commit e7a730f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions test/functional/rpcbind_test.py
Expand Up @@ -47,9 +47,12 @@ def run_allowip_test(self, allow_ips, rpchost, rpcport):
at a non-localhost IP.
'''
self.log.info("Allow IP test for %s:%d" % (rpchost, rpcport))
base_args = ['-disablewallet', '-nolisten'] + ['-rpcallowip='+x for x in allow_ips]
node_args = \
['-disablewallet', '-nolisten'] + \
['-rpcallowip='+x for x in allow_ips] + \
['-rpcbind='+addr for addr in ['127.0.0.1', "%s:%d" % (rpchost, rpcport)]] # Bind to localhost as well so start_nodes doesn't hang
self.nodes[0].rpchost = None
self.start_nodes([base_args])
self.start_nodes([node_args])
# connect to node through non-loopback interface
node = get_rpc_proxy(rpc_url(get_datadir_path(self.options.tmpdir, 0), 0, "%s:%d" % (rpchost, rpcport)), 0, coveragedir=self.options.coveragedir)
node.getnetworkinfo()
Expand Down Expand Up @@ -100,9 +103,9 @@ def _run_loopback_tests(self):
# check default without rpcallowip (IPv4 and IPv6 localhost)
self.run_bind_test(None, '127.0.0.1', [],
[('127.0.0.1', self.defaultport), ('::1', self.defaultport)])
# check default with rpcallowip (IPv6 any)
# check default with rpcallowip (IPv4 and IPv6 localhost)
self.run_bind_test(['127.0.0.1'], '127.0.0.1', [],
[('::0', self.defaultport)])
[('127.0.0.1', self.defaultport), ('::1', self.defaultport)])
# check only IPv6 localhost (explicit)
self.run_bind_test(['[::1]'], '[::1]', ['[::1]'],
[('::1', self.defaultport)])
Expand Down

0 comments on commit e7a730f

Please sign in to comment.