Skip to content

Commit 46b0fe7

Browse files
committed
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 ```
1 parent 81e4d54 commit 46b0fe7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/test/util/setup_common.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
223223
throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", state.ToString()));
224224
}
225225

226-
m_node.addrman = std::make_unique<AddrMan>(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/0);
226+
m_node.addrman = std::make_unique<AddrMan>(/*asmap=*/std::vector<bool>(),
227+
/*deterministic=*/false,
228+
m_node.args->GetIntArg("-checkaddrman", 0));
227229
m_node.banman = std::make_unique<BanMan>(m_args.GetDataDirBase() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME);
228230
m_node.connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests.
229231
m_node.peerman = PeerManager::make(chainparams, *m_node.connman, *m_node.addrman,

0 commit comments

Comments
 (0)