test: Improve loopback address check in rcp_bind.py

A loopback address can range from `127.0.0.0` to `127.255.255.255`.
This commit relaxes the loopback check in `rpc_bind.py` by checking whether
an IP address (from `all_interfaces()`) starts with `'127.'` instead of
strictly matching `'127.0.0.1'`.

Programs like VPNs might add an extra loopback address (e.g., 127.1.130.83),
which failed under the previous state. These addresses will now pass with this update.
This commit is contained in:
xyzconstant
2026-06-01 18:54:01 -03:00
parent 654a5223af
commit c8b8c275fa

View File

@@ -109,7 +109,7 @@ class RPCBindTest(BitcoinTestFramework):
raise AssertionError("all_interfaces() returned no IPv4 interfaces")
self.non_loopback_ip = None
for name,ip in interfaces:
if ip != '127.0.0.1':
if not ip.startswith('127.'):
self.non_loopback_ip = ip
break
if self.non_loopback_ip is None and self.options.run_nonloopback: