mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-01 02:29:36 +01:00
refactor: Use span instead of vector for data in util/asmap
This prevents holding the asmap data in memory twice. The version hash changes due to spans being serialized without their size-prefix (unlike vectors).
This commit is contained in:
@@ -325,7 +325,7 @@ BOOST_AUTO_TEST_CASE(subnet_test)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(netbase_getgroup)
|
||||
{
|
||||
NetGroupManager netgroupman{{}}; // use /16
|
||||
auto netgroupman{NetGroupManager::NoAsmap()}; // use /16
|
||||
BOOST_CHECK(netgroupman.GetGroup(ResolveIP("127.0.0.1")) == std::vector<unsigned char>({0})); // Local -> !Routable()
|
||||
BOOST_CHECK(netgroupman.GetGroup(ResolveIP("257.0.0.1")) == std::vector<unsigned char>({0})); // !Valid -> !Routable()
|
||||
BOOST_CHECK(netgroupman.GetGroup(ResolveIP("10.0.0.1")) == std::vector<unsigned char>({0})); // RFC1918 -> !Routable()
|
||||
@@ -631,7 +631,7 @@ BOOST_AUTO_TEST_CASE(asmap_test_vectors)
|
||||
"63dc33d28f757a4a5e15d6a08"_hex};
|
||||
|
||||
// Construct NetGroupManager with this data.
|
||||
NetGroupManager netgroup{std::vector(ASMAP_DATA.begin(), ASMAP_DATA.end())};
|
||||
auto netgroup{NetGroupManager::WithEmbeddedAsmap(ASMAP_DATA)};
|
||||
BOOST_CHECK(netgroup.UsingASMap());
|
||||
|
||||
// Check some randomly-generated IPv6 addresses in it (biased towards the very beginning and
|
||||
|
||||
Reference in New Issue
Block a user