mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 05:23:01 +01:00
tests: fix spurious addrman test failure
When inserting two addresses of the same class, from the same source, they have a 1/64 chance of colliding.
This commit is contained in:
parent
28c6e8d71b
commit
6b51b0a076
@ -104,10 +104,14 @@ BOOST_AUTO_TEST_CASE(addrman_simple)
|
|||||||
|
|
||||||
|
|
||||||
// Test: New table has one addr and we add a diff addr we should
|
// Test: New table has one addr and we add a diff addr we should
|
||||||
// have two addrs.
|
// have at least one addr.
|
||||||
|
// Note that addrman's size cannot be tested reliably after insertion, as
|
||||||
|
// hash collisions may occur. But we can always be sure of at least one
|
||||||
|
// success.
|
||||||
|
|
||||||
CService addr2 = ResolveService("250.1.1.2", 8333);
|
CService addr2 = ResolveService("250.1.1.2", 8333);
|
||||||
BOOST_CHECK(addrman.Add(CAddress(addr2, NODE_NONE), source));
|
BOOST_CHECK(addrman.Add(CAddress(addr2, NODE_NONE), source));
|
||||||
BOOST_CHECK_EQUAL(addrman.size(), 2);
|
BOOST_CHECK(addrman.size() >= 1);
|
||||||
|
|
||||||
// Test: AddrMan::Clear() should empty the new table.
|
// Test: AddrMan::Clear() should empty the new table.
|
||||||
addrman.Clear();
|
addrman.Clear();
|
||||||
@ -120,7 +124,7 @@ BOOST_AUTO_TEST_CASE(addrman_simple)
|
|||||||
vAddr.push_back(CAddress(ResolveService("250.1.1.3", 8333), NODE_NONE));
|
vAddr.push_back(CAddress(ResolveService("250.1.1.3", 8333), NODE_NONE));
|
||||||
vAddr.push_back(CAddress(ResolveService("250.1.1.4", 8333), NODE_NONE));
|
vAddr.push_back(CAddress(ResolveService("250.1.1.4", 8333), NODE_NONE));
|
||||||
BOOST_CHECK(addrman.Add(vAddr, source));
|
BOOST_CHECK(addrman.Add(vAddr, source));
|
||||||
BOOST_CHECK_EQUAL(addrman.size(), 2);
|
BOOST_CHECK(addrman.size() >= 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(addrman_ports)
|
BOOST_AUTO_TEST_CASE(addrman_ports)
|
||||||
|
Loading…
Reference in New Issue
Block a user