From 46b0fe78298c8f416a91dec9d4e0f3f4cb1e68b0 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Tue, 26 Oct 2021 17:56:19 +0200 Subject: [PATCH] test: non-addrman unit tests: override-able check ratio Make it possible to override from the command line (without recompiling) the addrman check ratio in the common `TestingSetup::m_node::addrman` (used by all unit tests) instead of hardcoding it to 0: ``` test_bitcoin --run_test="transaction_tests/tx_valid" -- -checkaddrman=1 ``` --- src/test/util/setup_common.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index b41c2aa12f4..c968e4d1244 100644 --- a/src/test/util/setup_common.cpp +++ b/src/test/util/setup_common.cpp @@ -223,7 +223,9 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector(/*asmap=*/std::vector(), /*deterministic=*/false, /*consistency_check_ratio=*/0); + m_node.addrman = std::make_unique(/*asmap=*/std::vector(), + /*deterministic=*/false, + m_node.args->GetIntArg("-checkaddrman", 0)); m_node.banman = std::make_unique(m_args.GetDataDirBase() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME); m_node.connman = std::make_unique(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests. m_node.peerman = PeerManager::make(chainparams, *m_node.connman, *m_node.addrman,