Merge bitcoin/bitcoin#24258: test: check localaddresses in getnetworkinfo for nodes with proxy

89bb25d22a0e1c700dba4e3b754984c9b2b14836 test: check localaddresses in getnetworkinfo for nodes with proxy (brunoerg)

Pull request description:

  This PR adds test coverage for the field `localaddresses` for `getnetworkinfo`. In this case, it verifies if this field is empty for all nodes since they are using proxy.

  Reference:
  515200298b/src/init.cpp (L449)

ACKs for top commit:
  jonatack:
    ACK 89bb25d22a0e1c700dba4e3b754984c9b2b14836

Tree-SHA512: 3c765c7060b6972c1ae5a1104734cd7669b650b5f6aa4f623f4299567732260da5083fef306a7c1e71c931f5d1396f24abad251d95c3d82b1f3ee0efee7fcd1f
This commit is contained in:
MarcoFalke 2022-03-28 09:00:05 +02:00 committed by pasta
parent c67f527b0b
commit 012b0b7169
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -237,7 +237,15 @@ class ProxyTest(BitcoinTestFramework):
return r
self.log.info("Test RPC getnetworkinfo")
n0 = networks_dict(self.nodes[0].getnetworkinfo())
nodes_network_info = []
self.log.debug("Test that setting -proxy disables local address discovery, i.e. -discover=0")
for node in self.nodes:
network_info = node.getnetworkinfo()
assert_equal(network_info["localaddresses"], [])
nodes_network_info.append(network_info)
n0 = networks_dict(nodes_network_info[0])
assert_equal(NETWORKS, n0.keys())
for net in NETWORKS:
if net == NET_I2P:
@ -252,7 +260,7 @@ class ProxyTest(BitcoinTestFramework):
assert_equal(n0['i2p']['reachable'], False)
assert_equal(n0['cjdns']['reachable'], False)
n1 = networks_dict(self.nodes[1].getnetworkinfo())
n1 = networks_dict(nodes_network_info[1])
assert_equal(NETWORKS, n1.keys())
for net in ['ipv4', 'ipv6']:
assert_equal(n1[net]['proxy'], f'{self.conf1.addr[0]}:{self.conf1.addr[1]}')
@ -264,7 +272,7 @@ class ProxyTest(BitcoinTestFramework):
assert_equal(n1['i2p']['proxy_randomize_credentials'], False)
assert_equal(n1['i2p']['reachable'], True)
n2 = networks_dict(self.nodes[2].getnetworkinfo())
n2 = networks_dict(nodes_network_info[2])
assert_equal(NETWORKS, n2.keys())
proxy = f'{self.conf2.addr[0]}:{self.conf2.addr[1]}'
for net in NETWORKS:
@ -281,7 +289,7 @@ class ProxyTest(BitcoinTestFramework):
assert_equal(n2['cjdns']['reachable'], False)
if self.have_ipv6:
n3 = networks_dict(self.nodes[3].getnetworkinfo())
n3 = networks_dict(nodes_network_info[3])
assert_equal(NETWORKS, n3.keys())
proxy = f'[{self.conf3.addr[0]}]:{self.conf3.addr[1]}'
for net in NETWORKS:
@ -292,7 +300,7 @@ class ProxyTest(BitcoinTestFramework):
assert_equal(n3['i2p']['reachable'], False)
assert_equal(n3['cjdns']['reachable'], False)
n4 = networks_dict(self.nodes[4].getnetworkinfo())
n4 = networks_dict(nodes_network_info[4])
assert_equal(NETWORKS, n4.keys())
for net in NETWORKS:
if net == NET_I2P: