Skip to content

Commit abbf4be

Browse files
committed
Merge #14861: tests: Modify rpc_bind to conform to #14532 behaviour.
f3cf95f tests: Modify rpc_bind to conform to #14532 behaviour. (Carl Dong) Pull request description: Fixes: bitcoin/bitcoin#14792 Tree-SHA512: 5ee63a06c92dae5406515e9e483188309b82e07b760f363d8c8ec46a42fe5f75f88724759b0ac8ef596ee28a135626e0582f575855c5dfec2fbfff2249a109f7
2 parents 8844588 + f3cf95f commit abbf4be

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/functional/rpc_bind.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,12 @@ def run_allowip_test(self, allow_ips, rpchost, rpcport):
4848
at a non-localhost IP.
4949
'''
5050
self.log.info("Allow IP test for %s:%d" % (rpchost, rpcport))
51-
base_args = ['-disablewallet', '-nolisten'] + ['-rpcallowip='+x for x in allow_ips]
51+
node_args = \
52+
['-disablewallet', '-nolisten'] + \
53+
['-rpcallowip='+x for x in allow_ips] + \
54+
['-rpcbind='+addr for addr in ['127.0.0.1', "%s:%d" % (rpchost, rpcport)]] # Bind to localhost as well so start_nodes doesn't hang
5255
self.nodes[0].rpchost = None
53-
self.start_nodes([base_args])
56+
self.start_nodes([node_args])
5457
# connect to node through non-loopback interface
5558
node = get_rpc_proxy(rpc_url(self.nodes[0].datadir, 0, "%s:%d" % (rpchost, rpcport)), 0, coveragedir=self.options.coveragedir)
5659
node.getnetworkinfo()
@@ -101,9 +104,9 @@ def _run_loopback_tests(self):
101104
# check default without rpcallowip (IPv4 and IPv6 localhost)
102105
self.run_bind_test(None, '127.0.0.1', [],
103106
[('127.0.0.1', self.defaultport), ('::1', self.defaultport)])
104-
# check default with rpcallowip (IPv6 any)
107+
# check default with rpcallowip (IPv4 and IPv6 localhost)
105108
self.run_bind_test(['127.0.0.1'], '127.0.0.1', [],
106-
[('::0', self.defaultport)])
109+
[('127.0.0.1', self.defaultport), ('::1', self.defaultport)])
107110
# check only IPv6 localhost (explicit)
108111
self.run_bind_test(['[::1]'], '[::1]', ['[::1]'],
109112
[('::1', self.defaultport)])

0 commit comments

Comments
 (0)