aboutsummaryrefslogtreecommitdiff
path: root/src/test/addrman_tests.cpp
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2021-07-23 10:48:34 +0100
committerJohn Newbery <john@johnnewbery.com>2021-08-05 17:10:30 +0100
commitfa9710f62c29c7f8d71c9f281001c9b5e70946bf (patch)
tree25117f2104f8d4a848e3760f3d02f76cef828faa /src/test/addrman_tests.cpp
parentee458d84fc187d69f002ebead6fccc4f4f9c0744 (diff)
[addrman] Add deterministic argument to CAddrMan ctor
Removes the need for tests to update nKey and insecure_rand after constructing a CAddrMan.
Diffstat (limited to 'src/test/addrman_tests.cpp')
-rw-r--r--src/test/addrman_tests.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/test/addrman_tests.cpp b/src/test/addrman_tests.cpp
index 79c7102c4f..0ab6cd0a2b 100644
--- a/src/test/addrman_tests.cpp
+++ b/src/test/addrman_tests.cpp
@@ -21,24 +21,13 @@ private:
bool deterministic;
public:
explicit CAddrManTest(bool makeDeterministic = true,
- std::vector<bool> asmap = std::vector<bool>())
+ std::vector<bool> asmap = std::vector<bool>())
+ : CAddrMan(makeDeterministic)
{
- if (makeDeterministic) {
- // Set addrman addr placement to be deterministic.
- MakeDeterministic();
- }
deterministic = makeDeterministic;
m_asmap = asmap;
}
- //! Ensure that bucket placement is always the same for testing purposes.
- void MakeDeterministic()
- {
- LOCK(cs);
- nKey.SetNull();
- insecure_rand = FastRandomContext(true);
- }
-
CAddrInfo* Find(const CNetAddr& addr, int* pnId = nullptr)
{
LOCK(cs);