diff --git a/src/graphs/default.graphml b/src/graphs/default.graphml index c7cf9df27..153bd52b0 100644 --- a/src/graphs/default.graphml +++ b/src/graphs/default.graphml @@ -8,13 +8,13 @@ - 26.0 + 27.0 -uacomment=w0 true true - 26.0 + 27.0 -uacomment=w1 true true @@ -26,42 +26,42 @@ true - 26.0 + 27.0 -uacomment=w3 true - 26.0 + 27.0 -uacomment=w4 true - 26.0 + 27.0 -uacomment=w5 true - 26.0 + 27.0 -uacomment=w6 - 26.0 + 27.0 -uacomment=w7 - 26.0 + 27.0 -uacomment=w8 - 26.0 + 27.0 -uacomment=w9 - 26.0 + 27.0 -uacomment=w10 - 26.0 + 27.0 -uacomment=w11 diff --git a/src/templates/addrman.patch b/src/templates/addrman.patch index bf625d912..50ea86e2c 100644 --- a/src/templates/addrman.patch +++ b/src/templates/addrman.patch @@ -1,17 +1,51 @@ diff --git a/src/netgroup.cpp b/src/netgroup.cpp -index 0ae229b3f3..a861a38852 100644 +index 0ae229b3f3..cc438c2f11 100644 --- a/src/netgroup.cpp +++ b/src/netgroup.cpp -@@ -43,11 +43,7 @@ std::vector NetGroupManager::GetGroup(const CNetAddr& address) co - } else if (!address.IsRoutable()) { - // all other unroutable addresses belong to the same group - } else if (address.HasLinkedIPv4()) { -- // IPv4 addresses (and mapped IPv4 addresses) use /16 groups -- uint32_t ipv4 = address.GetLinkedIPv4(); -- vchRet.push_back((ipv4 >> 24) & 0xFF); -- vchRet.push_back((ipv4 >> 16) & 0xFF); -- return vchRet; -+ nBits = 32; +@@ -47,6 +47,8 @@ std::vector NetGroupManager::GetGroup(const CNetAddr& address) co + uint32_t ipv4 = address.GetLinkedIPv4(); + vchRet.push_back((ipv4 >> 24) & 0xFF); + vchRet.push_back((ipv4 >> 16) & 0xFF); ++ vchRet.push_back((ipv4 >> 8) & 0xFF); ++ vchRet.push_back(ipv4 & 0xFF); + return vchRet; } else if (address.IsTor() || address.IsI2P()) { nBits = 4; - } else if (address.IsCJDNS()) { +diff --git a/src/test/addrman_tests.cpp b/src/test/addrman_tests.cpp +index 9668a85484..2fe70a538f 100644 +--- a/src/test/addrman_tests.cpp ++++ b/src/test/addrman_tests.cpp +@@ -499,6 +499,33 @@ BOOST_AUTO_TEST_CASE(caddrinfo_get_tried_bucket_legacy) + BOOST_CHECK_EQUAL(buckets.size(), 160U); + } + ++// run only this test! ++// test_bitcoin --run_test=addrman_tests/warnet_patch ++BOOST_AUTO_TEST_CASE(warnet_patch) ++{ ++ uint256 nKey1 = (HashWriter{} << 1).GetHash(); ++ ++ // One peer gives us all test addrs ++ CNetAddr source = ResolveIP("100.21.32.45"); ++ ++ // Addrs have common /8 /16 and /24 ++ CAddress addr1 = CAddress(ResolveService("100.20.30.40", 18444), NODE_NONE); ++ CAddress addr2 = CAddress(ResolveService("100.21.30.40", 18444), NODE_NONE); ++ CAddress addr3 = CAddress(ResolveService("100.20.31.40", 18444), NODE_NONE); ++ CAddress addr4 = CAddress(ResolveService("100.20.30.41", 18444), NODE_NONE); ++ ++ AddrInfo info1 = AddrInfo(addr1, source); ++ AddrInfo info2 = AddrInfo(addr2, source); ++ AddrInfo info3 = AddrInfo(addr3, source); ++ AddrInfo info4 = AddrInfo(addr4, source); ++ ++ // All addrs are in different buckets ++ BOOST_CHECK_EQUAL(info1.GetNewBucket(nKey1, EMPTY_NETGROUPMAN), 533); ++ BOOST_CHECK_EQUAL(info2.GetNewBucket(nKey1, EMPTY_NETGROUPMAN), 20); ++ BOOST_CHECK_EQUAL(info3.GetNewBucket(nKey1, EMPTY_NETGROUPMAN), 143); ++ BOOST_CHECK_EQUAL(info4.GetNewBucket(nKey1, EMPTY_NETGROUPMAN), 291); ++} ++ + BOOST_AUTO_TEST_CASE(caddrinfo_get_new_bucket_legacy) + { + CAddress addr1 = CAddress(ResolveService("250.1.2.1", 8333), NODE_NONE); diff --git a/src/warnet/tank.py b/src/warnet/tank.py index d3627bf73..4f45a2d2b 100644 --- a/src/warnet/tank.py +++ b/src/warnet/tank.py @@ -89,7 +89,7 @@ def parse_graph_node(self, node): if "ln" in node: options = { "impl": node["ln"], - "ln_image": node.get("ln_image", "lightninglabs/lnd:v0.17.0-beta"), + "ln_image": node.get("ln_image", "lightninglabs/lnd:v0.18.0-beta"), "cb_image": node.get("ln_cb_image", None), "ln_config": node.get("ln_config", "") } diff --git a/src/warnet/utils.py b/src/warnet/utils.py index b65a63b91..22f5e1154 100644 --- a/src/warnet/utils.py +++ b/src/warnet/utils.py @@ -22,11 +22,12 @@ SUPPORTED_TAGS = [ + "27.0", "26.0", "25.1", "24.2", "23.2", - "22.2", + "22.2" ] DEFAULT_TAG = SUPPORTED_TAGS[0] WEIGHTED_TAGS = [ diff --git a/test/data/v25_x_12.graphml b/test/data/12_node_ring.graphml similarity index 82% rename from test/data/v25_x_12.graphml rename to test/data/12_node_ring.graphml index 537f2834f..20e0b25ee 100644 --- a/test/data/v25_x_12.graphml +++ b/test/data/12_node_ring.graphml @@ -5,51 +5,51 @@ - 26.0 + 27.0 -uacomment=w0 -debug=validation - 26.0 + 27.0 -uacomment=w1 -debug=validation - 26.0 + 27.0 -uacomment=w2 -debug=validation - 26.0 + 27.0 -uacomment=w3 - 26.0 + 27.0 -uacomment=w4 - 26.0 + 27.0 -uacomment=w5 - 26.0 + 27.0 -uacomment=w6 - 26.0 + 27.0 -uacomment=w7 - 26.0 + 27.0 -uacomment=w8 - 26.0 + 27.0 -uacomment=w9 - 26.0 + 27.0 -uacomment=w10 - 26.0 + 27.0 diff --git a/test/data/build_v24_test.graphml b/test/data/build_v24_test.graphml index a549661d6..089b3f72d 100644 --- a/test/data/build_v24_test.graphml +++ b/test/data/build_v24_test.graphml @@ -6,7 +6,7 @@ - 26.0 + 27.0 -uacomment=w0 diff --git a/test/data/ln.graphml b/test/data/ln.graphml index 331f64f92..310bfa651 100644 --- a/test/data/ln.graphml +++ b/test/data/ln.graphml @@ -17,28 +17,28 @@ simln - 26.0 + 27.0 -uacomment=w0 lnd - lightninglabs/lnd:v0.15.5-beta + lightninglabs/lnd:v0.17.5-beta true - 26.0 + 27.0 -uacomment=w1 lnd pinheadmz/circuitbreaker:278737d true - 26.0 + 27.0 -uacomment=w2 lnd pinheadmz/circuitbreaker:278737d --bitcoin.timelockdelta=33 - 26.0 + 27.0 -uacomment=w3 diff --git a/test/data/permutations.graphml b/test/data/permutations.graphml index fa2514d54..7bf557ec7 100644 --- a/test/data/permutations.graphml +++ b/test/data/permutations.graphml @@ -10,7 +10,7 @@ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdr - 26.0 + 27.0 @@ -26,7 +26,7 @@ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdr False - 26.0 + 27.0 @@ -34,7 +34,7 @@ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdr False - 26.0 + 27.0 @@ -42,7 +42,7 @@ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdr False - 26.0 + 27.0 @@ -50,7 +50,7 @@ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdr False - 26.0 + 27.0 @@ -58,7 +58,7 @@ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdr False - 26.0 + 27.0 @@ -66,7 +66,7 @@ xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdr False - 26.0 + 27.0 diff --git a/test/data/services.graphml b/test/data/services.graphml index b92125bbc..b3195ad6a 100644 --- a/test/data/services.graphml +++ b/test/data/services.graphml @@ -17,7 +17,7 @@ cadvisor forkobserver addrmanobserver grafana nodeexporter prometheus - 26.0 + 27.0 -uacomment=w0 -debug=validation true lnd diff --git a/test/rpc_test.py b/test/rpc_test.py index 9b8a6a577..8f32fca0c 100755 --- a/test/rpc_test.py +++ b/test/rpc_test.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 +import json import os from pathlib import Path from test_base import TestBase -graph_file_path = Path(os.path.dirname(__file__)) / "data" / "v25_x_12.graphml" +graph_file_path = Path(os.path.dirname(__file__)) / "data" / "12_node_ring.graphml" base = TestBase() base.start_server() @@ -38,4 +39,15 @@ msgs = base.warcli("messages 0 1") assert "verack" in msgs +def got_addrs(): + addrman = json.loads(base.warcli("rpc 0 getrawaddrman")) + for key in ["tried", "new"]: + obj = addrman[key] + keys = list(obj.keys()) + groups = [g.split("/")[0] for g in keys] + if len(set(groups)) > 1: + return True + return False +base.wait_for_predicate(got_addrs) + base.stop_server() diff --git a/test/scenarios_test.py b/test/scenarios_test.py index b5f447a80..cd7bd55ab 100755 --- a/test/scenarios_test.py +++ b/test/scenarios_test.py @@ -5,7 +5,7 @@ from test_base import TestBase -graph_file_path = Path(os.path.dirname(__file__)) / "data" / "v25_x_12.graphml" +graph_file_path = Path(os.path.dirname(__file__)) / "data" / "12_node_ring.graphml" base = TestBase() base.start_server() diff --git a/test/v25_net_test.py b/test/v25_net_test.py index 3cb3a21fb..52295c09a 100755 --- a/test/v25_net_test.py +++ b/test/v25_net_test.py @@ -6,7 +6,7 @@ from test_base import TestBase -graph_file_path = Path(os.path.dirname(__file__)) / "data" / "v25_x_12.graphml" +graph_file_path = Path(os.path.dirname(__file__)) / "data" / "12_node_ring.graphml" base = TestBase() base.start_server()