diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2021-10-26 17:56:19 +0200 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2022-01-11 12:08:43 +0100 |
commit | 46b0fe78298c8f416a91dec9d4e0f3f4cb1e68b0 (patch) | |
tree | 2a3496cbc38a83add4f080130b64823fda434e3e | |
parent | 81e4d54d3a95f7bffeb353217a6c32eb2aca8b5c (diff) |
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
```
-rw-r--r-- | src/test/util/setup_common.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp index b41c2aa12f..c968e4d124 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<const throw std::runtime_error(strprintf("ActivateBestChain failed. (%s)", state.ToString())); } - m_node.addrman = std::make_unique<AddrMan>(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/0); + m_node.addrman = std::make_unique<AddrMan>(/*asmap=*/std::vector<bool>(), + /*deterministic=*/false, + m_node.args->GetIntArg("-checkaddrman", 0)); m_node.banman = std::make_unique<BanMan>(m_args.GetDataDirBase() / "banlist", nullptr, DEFAULT_MISBEHAVING_BANTIME); m_node.connman = std::make_unique<CConnman>(0x1337, 0x1337, *m_node.addrman); // Deterministic randomness for tests. m_node.peerman = PeerManager::make(chainparams, *m_node.connman, *m_node.addrman, |