mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
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:
parent
c67f527b0b
commit
012b0b7169
@ -237,7 +237,15 @@ class ProxyTest(BitcoinTestFramework):
|
|||||||
return r
|
return r
|
||||||
|
|
||||||
self.log.info("Test RPC getnetworkinfo")
|
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())
|
assert_equal(NETWORKS, n0.keys())
|
||||||
for net in NETWORKS:
|
for net in NETWORKS:
|
||||||
if net == NET_I2P:
|
if net == NET_I2P:
|
||||||
@ -252,7 +260,7 @@ class ProxyTest(BitcoinTestFramework):
|
|||||||
assert_equal(n0['i2p']['reachable'], False)
|
assert_equal(n0['i2p']['reachable'], False)
|
||||||
assert_equal(n0['cjdns']['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())
|
assert_equal(NETWORKS, n1.keys())
|
||||||
for net in ['ipv4', 'ipv6']:
|
for net in ['ipv4', 'ipv6']:
|
||||||
assert_equal(n1[net]['proxy'], f'{self.conf1.addr[0]}:{self.conf1.addr[1]}')
|
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']['proxy_randomize_credentials'], False)
|
||||||
assert_equal(n1['i2p']['reachable'], True)
|
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())
|
assert_equal(NETWORKS, n2.keys())
|
||||||
proxy = f'{self.conf2.addr[0]}:{self.conf2.addr[1]}'
|
proxy = f'{self.conf2.addr[0]}:{self.conf2.addr[1]}'
|
||||||
for net in NETWORKS:
|
for net in NETWORKS:
|
||||||
@ -281,7 +289,7 @@ class ProxyTest(BitcoinTestFramework):
|
|||||||
assert_equal(n2['cjdns']['reachable'], False)
|
assert_equal(n2['cjdns']['reachable'], False)
|
||||||
|
|
||||||
if self.have_ipv6:
|
if self.have_ipv6:
|
||||||
n3 = networks_dict(self.nodes[3].getnetworkinfo())
|
n3 = networks_dict(nodes_network_info[3])
|
||||||
assert_equal(NETWORKS, n3.keys())
|
assert_equal(NETWORKS, n3.keys())
|
||||||
proxy = f'[{self.conf3.addr[0]}]:{self.conf3.addr[1]}'
|
proxy = f'[{self.conf3.addr[0]}]:{self.conf3.addr[1]}'
|
||||||
for net in NETWORKS:
|
for net in NETWORKS:
|
||||||
@ -292,7 +300,7 @@ class ProxyTest(BitcoinTestFramework):
|
|||||||
assert_equal(n3['i2p']['reachable'], False)
|
assert_equal(n3['i2p']['reachable'], False)
|
||||||
assert_equal(n3['cjdns']['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())
|
assert_equal(NETWORKS, n4.keys())
|
||||||
for net in NETWORKS:
|
for net in NETWORKS:
|
||||||
if net == NET_I2P:
|
if net == NET_I2P:
|
||||||
|
Loading…
Reference in New Issue
Block a user