aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-12-01 18:38:48 +0800
committerfanquake <fanquake@gmail.com>2021-12-01 18:44:54 +0800
commit205877e55f7a5cab1f64f98d5305520744be06d2 (patch)
tree7a2e8e20b58d1320bd7859e40241d5a940db747c /src
parentf2074eeb2d9cd4c42936b5ba017de04cd129d9d7 (diff)
parentfa00447442f22a24e5ca5fc538d0bf7bef575544 (diff)
Merge bitcoin/bitcoin#23546: scripted-diff: Use clang-tidy syntax for C++ named arguments (tests only)
fa00447442f22a24e5ca5fc538d0bf7bef575544 scripted-diff: Use clang-tidy syntax for C++ named arguments (MarcoFalke) fae13c39896898aef2281433af143c22d8b3a3b4 doc: Use clang-tidy comments in crypto_tests (MarcoFalke) Pull request description: Incorrect named args are source of bugs, like #22979. To allow them being checked by `clang-tidy`, use a format it can understand. ACKs for top commit: shaavan: ACK fa00447442f22a24e5ca5fc538d0bf7bef575544 rajarshimaitra: ACK https://github.com/bitcoin/bitcoin/pull/23546/commits/fa00447442f22a24e5ca5fc538d0bf7bef575544 jonatack: ACK fa00447442f22a24e5ca5fc538d0bf7bef575544 fanquake: ACK fa00447442f22a24e5ca5fc538d0bf7bef575544 Tree-SHA512: 4d23a8363da81dfea21a4cd8516ab5e0dc70119e4d503f3f240f38573218b2c2e84083b97e956c62942d78b2f17490f8b3b2e8077d257644fda1d901e2b80507
Diffstat (limited to 'src')
-rw-r--r--src/test/addrman_tests.cpp22
-rw-r--r--src/test/coins_tests.cpp2
-rw-r--r--src/test/crypto_tests.cpp8
-rw-r--r--src/test/denialofservice_tests.cpp18
-rw-r--r--src/test/fuzz/addrman.cpp10
-rw-r--r--src/test/fuzz/banman.cpp4
-rw-r--r--src/test/fuzz/connman.cpp14
-rw-r--r--src/test/fuzz/deserialize.cpp2
-rw-r--r--src/test/fuzz/node_eviction.cpp24
-rw-r--r--src/test/fuzz/policy_estimator.cpp4
-rw-r--r--src/test/fuzz/process_message.cpp2
-rw-r--r--src/test/fuzz/process_messages.cpp2
-rw-r--r--src/test/fuzz/script.cpp2
-rw-r--r--src/test/fuzz/script_assets_test_minimizer.cpp2
-rw-r--r--src/test/fuzz/transaction.cpp4
-rw-r--r--src/test/fuzz/tx_pool.cpp10
-rw-r--r--src/test/fuzz/utxo_snapshot.cpp2
-rw-r--r--src/test/mempool_tests.cpp20
-rw-r--r--src/test/net_peer_eviction_tests.cpp100
-rw-r--r--src/test/net_tests.cpp2
-rw-r--r--src/test/scheduler_tests.cpp2
-rw-r--r--src/test/transaction_tests.cpp16
-rw-r--r--src/test/txpackage_tests.cpp6
-rw-r--r--src/test/util/chainstate.h2
-rw-r--r--src/test/util/net.cpp24
-rw-r--r--src/test/util/setup_common.cpp4
-rw-r--r--src/test/util/setup_common.h2
-rw-r--r--src/test/validation_chainstate_tests.cpp2
-rw-r--r--src/test/validation_chainstatemanager_tests.cpp8
-rw-r--r--src/test/validation_flush_tests.cpp16
-rw-r--r--src/wallet/test/coinselector_tests.cpp4
31 files changed, 170 insertions, 170 deletions
diff --git a/src/test/addrman_tests.cpp b/src/test/addrman_tests.cpp
index f82864b421..31f30d0379 100644
--- a/src/test/addrman_tests.cpp
+++ b/src/test/addrman_tests.cpp
@@ -26,7 +26,7 @@ class AddrManTest : public AddrMan
{
public:
explicit AddrManTest(std::vector<bool> asmap = std::vector<bool>())
- : AddrMan(asmap, /*deterministic=*/true, /* consistency_check_ratio */ 100)
+ : AddrMan(asmap, /*deterministic=*/true, /*consistency_check_ratio=*/100)
{}
AddrInfo* Find(const CService& addr)
@@ -376,7 +376,7 @@ BOOST_AUTO_TEST_CASE(addrman_getaddr)
// Test: Sanity check, GetAddr should never return anything if addrman
// is empty.
BOOST_CHECK_EQUAL(addrman.size(), 0U);
- std::vector<CAddress> vAddr1 = addrman.GetAddr(/* max_addresses */ 0, /* max_pct */ 0, /* network */ std::nullopt);
+ std::vector<CAddress> vAddr1 = addrman.GetAddr(/*max_addresses=*/0, /*max_pct=*/0, /*network=*/std::nullopt);
BOOST_CHECK_EQUAL(vAddr1.size(), 0U);
CAddress addr1 = CAddress(ResolveService("250.250.2.1", 8333), NODE_NONE);
@@ -396,15 +396,15 @@ BOOST_AUTO_TEST_CASE(addrman_getaddr)
BOOST_CHECK(addrman.Add({addr1, addr3, addr5}, source1));
BOOST_CHECK(addrman.Add({addr2, addr4}, source2));
- BOOST_CHECK_EQUAL(addrman.GetAddr(/* max_addresses */ 0, /* max_pct */ 0, /* network */ std::nullopt).size(), 5U);
+ BOOST_CHECK_EQUAL(addrman.GetAddr(/*max_addresses=*/0, /*max_pct=*/0, /*network=*/std::nullopt).size(), 5U);
// Net processing asks for 23% of addresses. 23% of 5 is 1 rounded down.
- BOOST_CHECK_EQUAL(addrman.GetAddr(/* max_addresses */ 2500, /* max_pct */ 23, /* network */ std::nullopt).size(), 1U);
+ BOOST_CHECK_EQUAL(addrman.GetAddr(/*max_addresses=*/2500, /*max_pct=*/23, /*network=*/std::nullopt).size(), 1U);
// Test: Ensure GetAddr works with new and tried addresses.
addrman.Good(CAddress(addr1, NODE_NONE));
addrman.Good(CAddress(addr2, NODE_NONE));
- BOOST_CHECK_EQUAL(addrman.GetAddr(/* max_addresses */ 0, /* max_pct */ 0, /* network */ std::nullopt).size(), 5U);
- BOOST_CHECK_EQUAL(addrman.GetAddr(/* max_addresses */ 2500, /* max_pct */ 23, /* network */ std::nullopt).size(), 1U);
+ BOOST_CHECK_EQUAL(addrman.GetAddr(/*max_addresses=*/0, /*max_pct=*/0, /*network=*/std::nullopt).size(), 5U);
+ BOOST_CHECK_EQUAL(addrman.GetAddr(/*max_addresses=*/2500, /*max_pct=*/23, /*network=*/std::nullopt).size(), 1U);
// Test: Ensure GetAddr still returns 23% when addrman has many addrs.
for (unsigned int i = 1; i < (8 * 256); i++) {
@@ -419,7 +419,7 @@ BOOST_AUTO_TEST_CASE(addrman_getaddr)
if (i % 8 == 0)
addrman.Good(addr);
}
- std::vector<CAddress> vAddr = addrman.GetAddr(/* max_addresses */ 2500, /* max_pct */ 23, /* network */ std::nullopt);
+ std::vector<CAddress> vAddr = addrman.GetAddr(/*max_addresses=*/2500, /*max_pct=*/23, /*network=*/std::nullopt);
size_t percent23 = (addrman.size() * 23) / 100;
BOOST_CHECK_EQUAL(vAddr.size(), percent23);
@@ -973,7 +973,7 @@ BOOST_AUTO_TEST_CASE(load_addrman)
// Test that the de-serialization does not throw an exception.
CDataStream ssPeers1 = AddrmanToStream(addrman);
bool exceptionThrown = false;
- AddrMan addrman1(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 100);
+ AddrMan addrman1(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/100);
BOOST_CHECK(addrman1.size() == 0);
try {
@@ -990,7 +990,7 @@ BOOST_AUTO_TEST_CASE(load_addrman)
// Test that ReadFromStream creates an addrman with the correct number of addrs.
CDataStream ssPeers2 = AddrmanToStream(addrman);
- AddrMan addrman2(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 100);
+ AddrMan addrman2(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/100);
BOOST_CHECK(addrman2.size() == 0);
ReadFromStream(addrman2, ssPeers2);
BOOST_CHECK(addrman2.size() == 3);
@@ -1028,7 +1028,7 @@ BOOST_AUTO_TEST_CASE(load_addrman_corrupted)
// Test that the de-serialization of corrupted peers.dat throws an exception.
CDataStream ssPeers1 = MakeCorruptPeersDat();
bool exceptionThrown = false;
- AddrMan addrman1(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 100);
+ AddrMan addrman1(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/100);
BOOST_CHECK(addrman1.size() == 0);
try {
unsigned char pchMsgTmp[4];
@@ -1044,7 +1044,7 @@ BOOST_AUTO_TEST_CASE(load_addrman_corrupted)
// Test that ReadFromStream fails if peers.dat is corrupt
CDataStream ssPeers2 = MakeCorruptPeersDat();
- AddrMan addrman2(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 100);
+ AddrMan addrman2(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/100);
BOOST_CHECK(addrman2.size() == 0);
BOOST_CHECK_THROW(ReadFromStream(addrman2, ssPeers2), std::ios_base::failure);
}
diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp
index 06db3b846e..91218511bd 100644
--- a/src/test/coins_tests.cpp
+++ b/src/test/coins_tests.cpp
@@ -269,7 +269,7 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
CCoinsViewTest base;
SimulationTest(&base, false);
- CCoinsViewDB db_base{"test", /*nCacheSize*/ 1 << 23, /*fMemory*/ true, /*fWipe*/ false};
+ CCoinsViewDB db_base{"test", /*nCacheSize=*/1 << 23, /*fMemory=*/true, /*fWipe=*/false};
SimulationTest(&db_base, true);
}
diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp
index 1483bd3cb3..cbdedd1b85 100644
--- a/src/test/crypto_tests.cpp
+++ b/src/test/crypto_tests.cpp
@@ -574,10 +574,10 @@ BOOST_AUTO_TEST_CASE(hkdf_hmac_sha256_l32_tests)
{
// Use rfc5869 test vectors but truncated to 32 bytes (our implementation only support length 32)
TestHKDF_SHA256_32(
- /* IKM */ "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
- /* salt */ "000102030405060708090a0b0c",
- /* info */ "f0f1f2f3f4f5f6f7f8f9",
- /* expected OKM */ "3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf");
+ /*ikm_hex=*/"0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b",
+ /*salt_hex=*/"000102030405060708090a0b0c",
+ /*info_hex=*/"f0f1f2f3f4f5f6f7f8f9",
+ /*okm_check_hex=*/"3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf");
TestHKDF_SHA256_32(
"000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f",
"606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf",
diff --git a/src/test/denialofservice_tests.cpp b/src/test/denialofservice_tests.cpp
index 765663e0ef..1662529594 100644
--- a/src/test/denialofservice_tests.cpp
+++ b/src/test/denialofservice_tests.cpp
@@ -213,13 +213,13 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
banman->ClearBanned();
nodes[0] = new CNode{id++, NODE_NETWORK, INVALID_SOCKET, addr[0], /*nKeyedNetGroupIn=*/0,
- /*nLocalHostNonceIn */ 0, CAddress(), /*addrNameIn=*/"",
+ /*nLocalHostNonceIn=*/0, CAddress(), /*addrNameIn=*/"",
ConnectionType::INBOUND, /*inbound_onion=*/false};
nodes[0]->SetCommonVersion(PROTOCOL_VERSION);
peerLogic->InitializeNode(nodes[0]);
nodes[0]->fSuccessfullyConnected = true;
connman->AddTestNode(*nodes[0]);
- peerLogic->Misbehaving(nodes[0]->GetId(), DISCOURAGEMENT_THRESHOLD, /* message */ ""); // Should be discouraged
+ peerLogic->Misbehaving(nodes[0]->GetId(), DISCOURAGEMENT_THRESHOLD, /*message=*/""); // Should be discouraged
{
LOCK(nodes[0]->cs_sendProcessing);
BOOST_CHECK(peerLogic->SendMessages(nodes[0]));
@@ -229,13 +229,13 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
BOOST_CHECK(!banman->IsDiscouraged(other_addr)); // Different address, not discouraged
nodes[1] = new CNode{id++, NODE_NETWORK, INVALID_SOCKET, addr[1], /*nKeyedNetGroupIn=*/1,
- /*nLocalHostNonceIn */ 1, CAddress(), /*addrNameIn=*/"",
+ /*nLocalHostNonceIn=*/1, CAddress(), /*addrNameIn=*/"",
ConnectionType::INBOUND, /*inbound_onion=*/false};
nodes[1]->SetCommonVersion(PROTOCOL_VERSION);
peerLogic->InitializeNode(nodes[1]);
nodes[1]->fSuccessfullyConnected = true;
connman->AddTestNode(*nodes[1]);
- peerLogic->Misbehaving(nodes[1]->GetId(), DISCOURAGEMENT_THRESHOLD - 1, /* message */ "");
+ peerLogic->Misbehaving(nodes[1]->GetId(), DISCOURAGEMENT_THRESHOLD - 1, /*message=*/"");
{
LOCK(nodes[1]->cs_sendProcessing);
BOOST_CHECK(peerLogic->SendMessages(nodes[1]));
@@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
// [1] is not discouraged/disconnected yet.
BOOST_CHECK(!banman->IsDiscouraged(addr[1]));
BOOST_CHECK(!nodes[1]->fDisconnect);
- peerLogic->Misbehaving(nodes[1]->GetId(), 1, /* message */ ""); // [1] reaches discouragement threshold
+ peerLogic->Misbehaving(nodes[1]->GetId(), 1, /*message=*/""); // [1] reaches discouragement threshold
{
LOCK(nodes[1]->cs_sendProcessing);
BOOST_CHECK(peerLogic->SendMessages(nodes[1]));
@@ -260,13 +260,13 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
// Make sure non-IP peers are discouraged and disconnected properly.
nodes[2] = new CNode{id++, NODE_NETWORK, INVALID_SOCKET, addr[2], /*nKeyedNetGroupIn=*/1,
- /*nLocalHostNonceIn */ 1, CAddress(), /*addrNameIn=*/"",
+ /*nLocalHostNonceIn=*/1, CAddress(), /*addrNameIn=*/"",
ConnectionType::OUTBOUND_FULL_RELAY, /*inbound_onion=*/false};
nodes[2]->SetCommonVersion(PROTOCOL_VERSION);
peerLogic->InitializeNode(nodes[2]);
nodes[2]->fSuccessfullyConnected = true;
connman->AddTestNode(*nodes[2]);
- peerLogic->Misbehaving(nodes[2]->GetId(), DISCOURAGEMENT_THRESHOLD, /* message */ "");
+ peerLogic->Misbehaving(nodes[2]->GetId(), DISCOURAGEMENT_THRESHOLD, /*message=*/"");
{
LOCK(nodes[2]->cs_sendProcessing);
BOOST_CHECK(peerLogic->SendMessages(nodes[2]));
@@ -302,7 +302,7 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
peerLogic->InitializeNode(&dummyNode);
dummyNode.fSuccessfullyConnected = true;
- peerLogic->Misbehaving(dummyNode.GetId(), DISCOURAGEMENT_THRESHOLD, /* message */ "");
+ peerLogic->Misbehaving(dummyNode.GetId(), DISCOURAGEMENT_THRESHOLD, /*message=*/"");
{
LOCK(dummyNode.cs_sendProcessing);
BOOST_CHECK(peerLogic->SendMessages(&dummyNode));
@@ -334,7 +334,7 @@ static void MakeNewKeyWithFastRandomContext(CKey& key)
{
std::vector<unsigned char> keydata;
keydata = g_insecure_rand_ctx.randbytes(32);
- key.Set(keydata.data(), keydata.data() + keydata.size(), /*fCompressedIn*/ true);
+ key.Set(keydata.data(), keydata.data() + keydata.size(), /*fCompressedIn=*/true);
assert(key.IsValid());
}
diff --git a/src/test/fuzz/addrman.cpp b/src/test/fuzz/addrman.cpp
index d427d12a3c..9c85c20e2b 100644
--- a/src/test/fuzz/addrman.cpp
+++ b/src/test/fuzz/addrman.cpp
@@ -29,7 +29,7 @@ FUZZ_TARGET_INIT(data_stream_addr_man, initialize_addrman)
{
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
CDataStream data_stream = ConsumeDataStream(fuzzed_data_provider);
- AddrMan addr_man(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
+ AddrMan addr_man(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/0);
try {
ReadFromStream(addr_man, data_stream);
} catch (const std::exception&) {
@@ -113,7 +113,7 @@ class AddrManDeterministic : public AddrMan
{
public:
explicit AddrManDeterministic(std::vector<bool> asmap, FuzzedDataProvider& fuzzed_data_provider)
- : AddrMan(std::move(asmap), /* deterministic */ true, /* consistency_check_ratio */ 0)
+ : AddrMan(std::move(asmap), /*deterministic=*/true, /*consistency_check_ratio=*/0)
{
WITH_LOCK(m_impl->cs, m_impl->insecure_rand = FastRandomContext{ConsumeUInt256(fuzzed_data_provider)});
}
@@ -286,9 +286,9 @@ FUZZ_TARGET_INIT(addrman, initialize_addrman)
}
const AddrMan& const_addr_man{addr_man};
(void)const_addr_man.GetAddr(
- /* max_addresses */ fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096),
- /* max_pct */ fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096),
- /* network */ std::nullopt);
+ /*max_addresses=*/fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096),
+ /*max_pct=*/fuzzed_data_provider.ConsumeIntegralInRange<size_t>(0, 4096),
+ /*network=*/std::nullopt);
(void)const_addr_man.Select(fuzzed_data_provider.ConsumeBool());
(void)const_addr_man.size();
CDataStream data_stream(SER_NETWORK, PROTOCOL_VERSION);
diff --git a/src/test/fuzz/banman.cpp b/src/test/fuzz/banman.cpp
index fbba25c404..b2969ecdc0 100644
--- a/src/test/fuzz/banman.cpp
+++ b/src/test/fuzz/banman.cpp
@@ -58,7 +58,7 @@ FUZZ_TARGET_INIT(banman, initialize_banman)
}
{
- BanMan ban_man{banlist_file, /* client_interface */ nullptr, /* default_ban_time */ ConsumeBanTimeOffset(fuzzed_data_provider)};
+ BanMan ban_man{banlist_file, /*client_interface=*/nullptr, /*default_ban_time=*/ConsumeBanTimeOffset(fuzzed_data_provider)};
// The complexity is O(N^2), where N is the input size, because each call
// might call DumpBanlist (or other methods that are at least linear
// complexity of the input size).
@@ -105,7 +105,7 @@ FUZZ_TARGET_INIT(banman, initialize_banman)
SetMockTime(ConsumeTime(fuzzed_data_provider));
banmap_t banmap;
ban_man.GetBanned(banmap);
- BanMan ban_man_read{banlist_file, /* client_interface */ nullptr, /* default_ban_time */ 0};
+ BanMan ban_man_read{banlist_file, /*client_interface=*/nullptr, /*default_ban_time=*/0};
banmap_t banmap_read;
ban_man_read.GetBanned(banmap_read);
assert(banmap == banmap_read);
diff --git a/src/test/fuzz/connman.cpp b/src/test/fuzz/connman.cpp
index 9e4718e603..b8f4ad8d94 100644
--- a/src/test/fuzz/connman.cpp
+++ b/src/test/fuzz/connman.cpp
@@ -25,7 +25,7 @@ FUZZ_TARGET_INIT(connman, initialize_connman)
{
FuzzedDataProvider fuzzed_data_provider{buffer.data(), buffer.size()};
SetMockTime(ConsumeTime(fuzzed_data_provider));
- AddrMan addrman(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
+ AddrMan addrman(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/0);
CConnman connman{fuzzed_data_provider.ConsumeIntegral<uint64_t>(), fuzzed_data_provider.ConsumeIntegral<uint64_t>(), addrman, fuzzed_data_provider.ConsumeBool()};
CNetAddr random_netaddr;
CNode random_node = ConsumeNode(fuzzed_data_provider);
@@ -69,15 +69,15 @@ FUZZ_TARGET_INIT(connman, initialize_connman)
},
[&] {
(void)connman.GetAddresses(
- /* max_addresses */ fuzzed_data_provider.ConsumeIntegral<size_t>(),
- /* max_pct */ fuzzed_data_provider.ConsumeIntegral<size_t>(),
- /* network */ std::nullopt);
+ /*max_addresses=*/fuzzed_data_provider.ConsumeIntegral<size_t>(),
+ /*max_pct=*/fuzzed_data_provider.ConsumeIntegral<size_t>(),
+ /*network=*/std::nullopt);
},
[&] {
(void)connman.GetAddresses(
- /* requestor */ random_node,
- /* max_addresses */ fuzzed_data_provider.ConsumeIntegral<size_t>(),
- /* max_pct */ fuzzed_data_provider.ConsumeIntegral<size_t>());
+ /*requestor=*/random_node,
+ /*max_addresses=*/fuzzed_data_provider.ConsumeIntegral<size_t>(),
+ /*max_pct=*/fuzzed_data_provider.ConsumeIntegral<size_t>());
},
[&] {
(void)connman.GetDeterministicRandomizer(fuzzed_data_provider.ConsumeIntegral<uint64_t>());
diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp
index a9325fa738..48574d71cc 100644
--- a/src/test/fuzz/deserialize.cpp
+++ b/src/test/fuzz/deserialize.cpp
@@ -189,7 +189,7 @@ FUZZ_TARGET_DESERIALIZE(blockmerkleroot, {
BlockMerkleRoot(block, &mutated);
})
FUZZ_TARGET_DESERIALIZE(addrman_deserialize, {
- AddrMan am(/* asmap */ std::vector<bool>(), /* deterministic */ false, /* consistency_check_ratio */ 0);
+ AddrMan am(/*asmap=*/std::vector<bool>(), /*deterministic=*/false, /*consistency_check_ratio=*/0);
DeserializeFromFuzzingInput(buffer, am);
})
FUZZ_TARGET_DESERIALIZE(blockheader_deserialize, {
diff --git a/src/test/fuzz/node_eviction.cpp b/src/test/fuzz/node_eviction.cpp
index 2e3b51e753..64031fde42 100644
--- a/src/test/fuzz/node_eviction.cpp
+++ b/src/test/fuzz/node_eviction.cpp
@@ -20,18 +20,18 @@ FUZZ_TARGET(node_eviction)
std::vector<NodeEvictionCandidate> eviction_candidates;
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 10000) {
eviction_candidates.push_back({
- /* id */ fuzzed_data_provider.ConsumeIntegral<NodeId>(),
- /* nTimeConnected */ fuzzed_data_provider.ConsumeIntegral<int64_t>(),
- /* m_min_ping_time */ std::chrono::microseconds{fuzzed_data_provider.ConsumeIntegral<int64_t>()},
- /* nLastBlockTime */ fuzzed_data_provider.ConsumeIntegral<int64_t>(),
- /* nLastTXTime */ fuzzed_data_provider.ConsumeIntegral<int64_t>(),
- /* fRelevantServices */ fuzzed_data_provider.ConsumeBool(),
- /* fRelayTxes */ fuzzed_data_provider.ConsumeBool(),
- /* fBloomFilter */ fuzzed_data_provider.ConsumeBool(),
- /* nKeyedNetGroup */ fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
- /* prefer_evict */ fuzzed_data_provider.ConsumeBool(),
- /* m_is_local */ fuzzed_data_provider.ConsumeBool(),
- /* m_network */ fuzzed_data_provider.PickValueInArray(ALL_NETWORKS),
+ /*id=*/fuzzed_data_provider.ConsumeIntegral<NodeId>(),
+ /*nTimeConnected=*/fuzzed_data_provider.ConsumeIntegral<int64_t>(),
+ /*m_min_ping_time=*/std::chrono::microseconds{fuzzed_data_provider.ConsumeIntegral<int64_t>()},
+ /*nLastBlockTime=*/fuzzed_data_provider.ConsumeIntegral<int64_t>(),
+ /*nLastTXTime=*/fuzzed_data_provider.ConsumeIntegral<int64_t>(),
+ /*fRelevantServices=*/fuzzed_data_provider.ConsumeBool(),
+ /*fRelayTxes=*/fuzzed_data_provider.ConsumeBool(),
+ /*fBloomFilter=*/fuzzed_data_provider.ConsumeBool(),
+ /*nKeyedNetGroup=*/fuzzed_data_provider.ConsumeIntegral<uint64_t>(),
+ /*prefer_evict=*/fuzzed_data_provider.ConsumeBool(),
+ /*m_is_local=*/fuzzed_data_provider.ConsumeBool(),
+ /*m_network=*/fuzzed_data_provider.PickValueInArray(ALL_NETWORKS),
});
}
// Make a copy since eviction_candidates may be in some valid but otherwise
diff --git a/src/test/fuzz/policy_estimator.cpp b/src/test/fuzz/policy_estimator.cpp
index 63dc4ce1d9..e4d95f72a0 100644
--- a/src/test/fuzz/policy_estimator.cpp
+++ b/src/test/fuzz/policy_estimator.cpp
@@ -35,7 +35,7 @@ FUZZ_TARGET_INIT(policy_estimator, initialize_policy_estimator)
const CTransaction tx{*mtx};
block_policy_estimator.processTransaction(ConsumeTxMemPoolEntry(fuzzed_data_provider, tx), fuzzed_data_provider.ConsumeBool());
if (fuzzed_data_provider.ConsumeBool()) {
- (void)block_policy_estimator.removeTx(tx.GetHash(), /* inBlock */ fuzzed_data_provider.ConsumeBool());
+ (void)block_policy_estimator.removeTx(tx.GetHash(), /*inBlock=*/fuzzed_data_provider.ConsumeBool());
}
},
[&] {
@@ -56,7 +56,7 @@ FUZZ_TARGET_INIT(policy_estimator, initialize_policy_estimator)
block_policy_estimator.processBlock(fuzzed_data_provider.ConsumeIntegral<unsigned int>(), ptrs);
},
[&] {
- (void)block_policy_estimator.removeTx(ConsumeUInt256(fuzzed_data_provider), /* inBlock */ fuzzed_data_provider.ConsumeBool());
+ (void)block_policy_estimator.removeTx(ConsumeUInt256(fuzzed_data_provider), /*inBlock=*/fuzzed_data_provider.ConsumeBool());
},
[&] {
block_policy_estimator.FlushUnconfirmed();
diff --git a/src/test/fuzz/process_message.cpp b/src/test/fuzz/process_message.cpp
index 7b99193ad0..94a71859e9 100644
--- a/src/test/fuzz/process_message.cpp
+++ b/src/test/fuzz/process_message.cpp
@@ -83,7 +83,7 @@ void fuzz_target(FuzzBufferType buffer, const std::string& LIMIT_TO_MESSAGE_TYPE
p2p_node.fSuccessfullyConnected = successfully_connected;
connman.AddTestNode(p2p_node);
g_setup->m_node.peerman->InitializeNode(&p2p_node);
- FillNode(fuzzed_data_provider, p2p_node, /* init_version */ successfully_connected);
+ FillNode(fuzzed_data_provider, p2p_node, /*init_version=*/successfully_connected);
const auto mock_time = ConsumeTime(fuzzed_data_provider);
SetMockTime(mock_time);
diff --git a/src/test/fuzz/process_messages.cpp b/src/test/fuzz/process_messages.cpp
index 91ec2aafde..21a959315e 100644
--- a/src/test/fuzz/process_messages.cpp
+++ b/src/test/fuzz/process_messages.cpp
@@ -50,7 +50,7 @@ FUZZ_TARGET_INIT(process_messages, initialize_process_messages)
p2p_node.fSuccessfullyConnected = successfully_connected;
p2p_node.fPauseSend = false;
g_setup->m_node.peerman->InitializeNode(&p2p_node);
- FillNode(fuzzed_data_provider, p2p_node, /* init_version */ successfully_connected);
+ FillNode(fuzzed_data_provider, p2p_node, /*init_version=*/successfully_connected);
connman.AddTestNode(p2p_node);
}
diff --git a/src/test/fuzz/script.cpp b/src/test/fuzz/script.cpp
index 0979967384..eb170aab76 100644
--- a/src/test/fuzz/script.cpp
+++ b/src/test/fuzz/script.cpp
@@ -164,7 +164,7 @@ FUZZ_TARGET_INIT(script, initialize_script)
const std::string encoded_dest{EncodeDestination(tx_destination_1)};
const UniValue json_dest{DescribeAddress(tx_destination_1)};
Assert(tx_destination_1 == DecodeDestination(encoded_dest));
- (void)GetKeyForDestination(/* store */ {}, tx_destination_1);
+ (void)GetKeyForDestination(/*store=*/{}, tx_destination_1);
const CScript dest{GetScriptForDestination(tx_destination_1)};
const bool valid{IsValidDestination(tx_destination_1)};
Assert(dest.empty() != valid);
diff --git a/src/test/fuzz/script_assets_test_minimizer.cpp b/src/test/fuzz/script_assets_test_minimizer.cpp
index a80338b965..4669f783aa 100644
--- a/src/test/fuzz/script_assets_test_minimizer.cpp
+++ b/src/test/fuzz/script_assets_test_minimizer.cpp
@@ -190,7 +190,7 @@ void test_init()
static ECCVerifyHandle handle;
}
-FUZZ_TARGET_INIT_HIDDEN(script_assets_test_minimizer, test_init, /* hidden */ true)
+FUZZ_TARGET_INIT_HIDDEN(script_assets_test_minimizer, test_init, /*hidden=*/true)
{
if (buffer.size() < 2 || buffer.back() != '\n' || buffer[buffer.size() - 2] != ',') return;
const std::string str((const char*)buffer.data(), buffer.size() - 2);
diff --git a/src/test/fuzz/transaction.cpp b/src/test/fuzz/transaction.cpp
index ba6c500543..389da6f5d7 100644
--- a/src/test/fuzz/transaction.cpp
+++ b/src/test/fuzz/transaction.cpp
@@ -102,6 +102,6 @@ FUZZ_TARGET_INIT(transaction, initialize_transaction)
(void)IsWitnessStandard(tx, coins_view_cache);
UniValue u(UniValue::VOBJ);
- TxToUniv(tx, /* hashBlock */ uint256::ZERO, u);
- TxToUniv(tx, /* hashBlock */ uint256::ONE, u);
+ TxToUniv(tx, /*hashBlock=*/uint256::ZERO, u);
+ TxToUniv(tx, /*hashBlock=*/uint256::ONE, u);
}
diff --git a/src/test/fuzz/tx_pool.cpp b/src/test/fuzz/tx_pool.cpp
index ac1fb657f1..702660f63e 100644
--- a/src/test/fuzz/tx_pool.cpp
+++ b/src/test/fuzz/tx_pool.cpp
@@ -85,7 +85,7 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, CCh
{
BlockAssembler::Options options;
options.nBlockMaxWeight = fuzzed_data_provider.ConsumeIntegralInRange(0U, MAX_BLOCK_WEIGHT);
- options.blockMinFeeRate = CFeeRate{ConsumeMoney(fuzzed_data_provider, /* max */ COIN)};
+ options.blockMinFeeRate = CFeeRate{ConsumeMoney(fuzzed_data_provider, /*max=*/COIN)};
auto assembler = BlockAssembler{chainstate, *static_cast<CTxMemPool*>(&tx_pool), ::Params(), options};
auto block_template = assembler.CreateNewBlock(CScript{} << OP_TRUE);
Assert(block_template->block.vtx.size() >= 1);
@@ -131,7 +131,7 @@ FUZZ_TARGET_INIT(tx_pool_standard, initialize_tx_pool)
// The sum of the values of all spendable outpoints
constexpr CAmount SUPPLY_TOTAL{COINBASE_MATURITY * 50 * COIN};
- CTxMemPool tx_pool_{/* estimator */ nullptr, /* check_ratio */ 1};
+ CTxMemPool tx_pool_{/*estimator=*/nullptr, /*check_ratio=*/1};
MockedTxPool& tx_pool = *static_cast<MockedTxPool*>(&tx_pool_);
// Helper to query an amount
@@ -267,10 +267,10 @@ FUZZ_TARGET_INIT(tx_pool_standard, initialize_tx_pool)
// Outpoints that no longer count toward the total supply
std::set<COutPoint> consumed_supply;
for (const auto& removed_tx : removed) {
- insert_tx(/* created_by_tx */ {consumed_erased}, /* consumed_by_tx */ {outpoints_supply}, /* tx */ *removed_tx);
+ insert_tx(/*created_by_tx=*/{consumed_erased}, /*consumed_by_tx=*/{outpoints_supply}, /*tx=*/*removed_tx);
}
for (const auto& added_tx : added) {
- insert_tx(/* created_by_tx */ {outpoints_supply, outpoints_rbf}, /* consumed_by_tx */ {consumed_supply}, /* tx */ *added_tx);
+ insert_tx(/*created_by_tx=*/{outpoints_supply, outpoints_rbf}, /*consumed_by_tx=*/{consumed_supply}, /*tx=*/*added_tx);
}
for (const auto& p : consumed_erased) {
Assert(outpoints_supply.erase(p) == 1);
@@ -303,7 +303,7 @@ FUZZ_TARGET_INIT(tx_pool, initialize_tx_pool)
txids.push_back(ConsumeUInt256(fuzzed_data_provider));
}
- CTxMemPool tx_pool_{/* estimator */ nullptr, /* check_ratio */ 1};
+ CTxMemPool tx_pool_{/*estimator=*/nullptr, /*check_ratio=*/1};
MockedTxPool& tx_pool = *static_cast<MockedTxPool*>(&tx_pool_);
LIMITED_WHILE(fuzzed_data_provider.ConsumeBool(), 300)
diff --git a/src/test/fuzz/utxo_snapshot.cpp b/src/test/fuzz/utxo_snapshot.cpp
index 8d2a06f11a..02039cba81 100644
--- a/src/test/fuzz/utxo_snapshot.cpp
+++ b/src/test/fuzz/utxo_snapshot.cpp
@@ -49,7 +49,7 @@ FUZZ_TARGET_INIT(utxo_snapshot, initialize_chain)
} catch (const std::ios_base::failure&) {
return false;
}
- return chainman.ActivateSnapshot(infile, metadata, /* in_memory */ true);
+ return chainman.ActivateSnapshot(infile, metadata, /*in_memory=*/true);
}};
if (fuzzed_data_provider.ConsumeBool()) {
diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp
index b3497b8ef8..005752d508 100644
--- a/src/test/mempool_tests.cpp
+++ b/src/test/mempool_tests.cpp
@@ -602,7 +602,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
//
// [tx1]
//
- CTransactionRef tx1 = make_tx(/* output_values */ {10 * COIN});
+ CTransactionRef tx1 = make_tx(/*output_values=*/{10 * COIN});
pool.addUnchecked(entry.Fee(10000LL).FromTx(tx1));
// Ancestors / descendants should be 1 / 1 (itself / itself)
@@ -614,7 +614,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
//
// [tx1].0 <- [tx2]
//
- CTransactionRef tx2 = make_tx(/* output_values */ {495 * CENT, 5 * COIN}, /* inputs */ {tx1});
+ CTransactionRef tx2 = make_tx(/*output_values=*/{495 * CENT, 5 * COIN}, /*inputs=*/{tx1});
pool.addUnchecked(entry.Fee(10000LL).FromTx(tx2));
// Ancestors / descendants should be:
@@ -633,7 +633,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
//
// [tx1].0 <- [tx2].0 <- [tx3]
//
- CTransactionRef tx3 = make_tx(/* output_values */ {290 * CENT, 200 * CENT}, /* inputs */ {tx2});
+ CTransactionRef tx3 = make_tx(/*output_values=*/{290 * CENT, 200 * CENT}, /*inputs=*/{tx2});
pool.addUnchecked(entry.Fee(10000LL).FromTx(tx3));
// Ancestors / descendants should be:
@@ -658,7 +658,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
// |
// \---1 <- [tx4]
//
- CTransactionRef tx4 = make_tx(/* output_values */ {290 * CENT, 250 * CENT}, /* inputs */ {tx2}, /* input_indices */ {1});
+ CTransactionRef tx4 = make_tx(/*output_values=*/{290 * CENT, 250 * CENT}, /*inputs=*/{tx2}, /*input_indices=*/{1});
pool.addUnchecked(entry.Fee(10000LL).FromTx(tx4));
// Ancestors / descendants should be:
@@ -694,14 +694,14 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
CAmount v = 5 * COIN;
for (uint64_t i = 0; i < 5; i++) {
CTransactionRef& tyi = *ty[i];
- tyi = make_tx(/* output_values */ {v}, /* inputs */ i > 0 ? std::vector<CTransactionRef>{*ty[i - 1]} : std::vector<CTransactionRef>{});
+ tyi = make_tx(/*output_values=*/{v}, /*inputs=*/i > 0 ? std::vector<CTransactionRef>{*ty[i - 1]} : std::vector<CTransactionRef>{});
v -= 50 * CENT;
pool.addUnchecked(entry.Fee(10000LL).FromTx(tyi));
pool.GetTransactionAncestry(tyi->GetHash(), ancestors, descendants);
BOOST_CHECK_EQUAL(ancestors, i+1);
BOOST_CHECK_EQUAL(descendants, i+1);
}
- CTransactionRef ty6 = make_tx(/* output_values */ {5 * COIN}, /* inputs */ {tx3, ty5});
+ CTransactionRef ty6 = make_tx(/*output_values=*/{5 * COIN}, /*inputs=*/{tx3, ty5});
pool.addUnchecked(entry.Fee(10000LL).FromTx(ty6));
// Ancestors / descendants should be:
@@ -755,10 +755,10 @@ BOOST_AUTO_TEST_CASE(MempoolAncestryTests)
// \---1 <- [tc].0 --<--/
//
CTransactionRef ta, tb, tc, td;
- ta = make_tx(/* output_values */ {10 * COIN});
- tb = make_tx(/* output_values */ {5 * COIN, 3 * COIN}, /* inputs */ {ta});
- tc = make_tx(/* output_values */ {2 * COIN}, /* inputs */ {tb}, /* input_indices */ {1});
- td = make_tx(/* output_values */ {6 * COIN}, /* inputs */ {tb, tc}, /* input_indices */ {0, 0});
+ ta = make_tx(/*output_values=*/{10 * COIN});
+ tb = make_tx(/*output_values=*/{5 * COIN, 3 * COIN}, /*inputs=*/ {ta});
+ tc = make_tx(/*output_values=*/{2 * COIN}, /*inputs=*/{tb}, /*input_indices=*/{1});
+ td = make_tx(/*output_values=*/{6 * COIN}, /*inputs=*/{tb, tc}, /*input_indices=*/{0, 0});
pool.clear();
pool.addUnchecked(entry.Fee(10000LL).FromTx(ta));
pool.addUnchecked(entry.Fee(10000LL).FromTx(tb));
diff --git a/src/test/net_peer_eviction_tests.cpp b/src/test/net_peer_eviction_tests.cpp
index 5eb280b498..9470ed814d 100644
--- a/src/test/net_peer_eviction_tests.cpp
+++ b/src/test/net_peer_eviction_tests.cpp
@@ -72,8 +72,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = false;
c.m_network = NET_IPV4;
},
- /* protected_peer_ids */ {0, 1, 2, 3, 4, 5},
- /* unprotected_peer_ids */ {6, 7, 8, 9, 10, 11},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 4, 5},
+ /*unprotected_peer_ids=*/{6, 7, 8, 9, 10, 11},
random_context));
// Verify in the opposite direction.
@@ -83,8 +83,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = false;
c.m_network = NET_IPV6;
},
- /* protected_peer_ids */ {6, 7, 8, 9, 10, 11},
- /* unprotected_peer_ids */ {0, 1, 2, 3, 4, 5},
+ /*protected_peer_ids=*/{6, 7, 8, 9, 10, 11},
+ /*unprotected_peer_ids=*/{0, 1, 2, 3, 4, 5},
random_context));
// Test protection of onion, localhost, and I2P peers...
@@ -96,8 +96,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = false;
c.m_network = (c.id == 3 || c.id == 8 || c.id == 9) ? NET_ONION : NET_IPV4;
},
- /* protected_peer_ids */ {3, 8, 9},
- /* unprotected_peer_ids */ {},
+ /*protected_peer_ids=*/{3, 8, 9},
+ /*unprotected_peer_ids=*/{},
random_context));
// Expect 1/4 onion peers and 1/4 of the other peers to be protected,
@@ -108,8 +108,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = false;
c.m_network = (c.id == 3 || c.id > 7) ? NET_ONION : NET_IPV6;
},
- /* protected_peer_ids */ {0, 1, 2, 3, 8, 9},
- /* unprotected_peer_ids */ {4, 5, 6, 7, 10, 11},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 8, 9},
+ /*unprotected_peer_ids=*/{4, 5, 6, 7, 10, 11},
random_context));
// Expect 1/4 localhost peers to be protected from eviction,
@@ -119,8 +119,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id == 1 || c.id == 9 || c.id == 11);
c.m_network = NET_IPV4;
},
- /* protected_peer_ids */ {1, 9, 11},
- /* unprotected_peer_ids */ {},
+ /*protected_peer_ids=*/{1, 9, 11},
+ /*unprotected_peer_ids=*/{},
random_context));
// Expect 1/4 localhost peers and 1/4 of the other peers to be protected,
@@ -131,8 +131,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id > 6);
c.m_network = NET_IPV6;
},
- /* protected_peer_ids */ {0, 1, 2, 7, 8, 9},
- /* unprotected_peer_ids */ {3, 4, 5, 6, 10, 11},
+ /*protected_peer_ids=*/{0, 1, 2, 7, 8, 9},
+ /*unprotected_peer_ids=*/{3, 4, 5, 6, 10, 11},
random_context));
// Expect 1/4 I2P peers to be protected from eviction,
@@ -142,8 +142,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = false;
c.m_network = (c.id == 2 || c.id == 7 || c.id == 10) ? NET_I2P : NET_IPV4;
},
- /* protected_peer_ids */ {2, 7, 10},
- /* unprotected_peer_ids */ {},
+ /*protected_peer_ids=*/{2, 7, 10},
+ /*unprotected_peer_ids=*/{},
random_context));
// Expect 1/4 I2P peers and 1/4 of the other peers to be protected,
@@ -154,8 +154,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = false;
c.m_network = (c.id == 4 || c.id > 8) ? NET_I2P : NET_IPV6;
},
- /* protected_peer_ids */ {0, 1, 2, 4, 9, 10},
- /* unprotected_peer_ids */ {3, 5, 6, 7, 8, 11},
+ /*protected_peer_ids=*/{0, 1, 2, 4, 9, 10},
+ /*unprotected_peer_ids=*/{3, 5, 6, 7, 8, 11},
random_context));
// Tests with 2 networks...
@@ -169,8 +169,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id == 4);
c.m_network = (c.id == 3) ? NET_ONION : NET_IPV4;
},
- /* protected_peer_ids */ {0, 4},
- /* unprotected_peer_ids */ {1, 2},
+ /*protected_peer_ids=*/{0, 4},
+ /*unprotected_peer_ids=*/{1, 2},
random_context));
// Combined test: expect having 1 localhost and 1 onion peer out of 7 to
@@ -182,8 +182,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id == 6);
c.m_network = (c.id == 5) ? NET_ONION : NET_IPV4;
},
- /* protected_peer_ids */ {0, 1, 6},
- /* unprotected_peer_ids */ {2, 3, 4, 5},
+ /*protected_peer_ids=*/{0, 1, 6},
+ /*unprotected_peer_ids=*/{2, 3, 4, 5},
random_context));
// Combined test: expect having 1 localhost and 1 onion peer out of 8 to
@@ -195,8 +195,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id == 6);
c.m_network = (c.id == 5) ? NET_ONION : NET_IPV4;
},
- /* protected_peer_ids */ {0, 1, 5, 6},
- /* unprotected_peer_ids */ {2, 3, 4, 7},
+ /*protected_peer_ids=*/{0, 1, 5, 6},
+ /*unprotected_peer_ids=*/{2, 3, 4, 7},
random_context));
// Combined test: expect having 3 localhost and 3 onion peers out of 12 to
@@ -208,8 +208,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id == 6 || c.id == 9 || c.id == 11);
c.m_network = (c.id == 7 || c.id == 8 || c.id == 10) ? NET_ONION : NET_IPV6;
},
- /* protected_peer_ids */ {0, 1, 2, 6, 7, 9},
- /* unprotected_peer_ids */ {3, 4, 5, 8, 10, 11},
+ /*protected_peer_ids=*/{0, 1, 2, 6, 7, 9},
+ /*unprotected_peer_ids=*/{3, 4, 5, 8, 10, 11},
random_context));
// Combined test: expect having 4 localhost and 1 onion peer out of 12 to
@@ -220,8 +220,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id > 4 && c.id < 9);
c.m_network = (c.id == 10) ? NET_ONION : NET_IPV4;
},
- /* protected_peer_ids */ {0, 1, 2, 5, 6, 10},
- /* unprotected_peer_ids */ {3, 4, 7, 8, 9, 11},
+ /*protected_peer_ids=*/{0, 1, 2, 5, 6, 10},
+ /*unprotected_peer_ids=*/{3, 4, 7, 8, 9, 11},
random_context));
// Combined test: expect having 4 localhost and 2 onion peers out of 16 to
@@ -232,8 +232,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id == 6 || c.id == 9 || c.id == 11 || c.id == 12);
c.m_network = (c.id == 8 || c.id == 10) ? NET_ONION : NET_IPV6;
},
- /* protected_peer_ids */ {0, 1, 2, 3, 6, 8, 9, 10},
- /* unprotected_peer_ids */ {4, 5, 7, 11, 12, 13, 14, 15},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 6, 8, 9, 10},
+ /*unprotected_peer_ids=*/{4, 5, 7, 11, 12, 13, 14, 15},
random_context));
// Combined test: expect having 5 localhost and 1 onion peer out of 16 to
@@ -245,8 +245,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id > 10);
c.m_network = (c.id == 10) ? NET_ONION : NET_IPV4;
},
- /* protected_peer_ids */ {0, 1, 2, 3, 10, 11, 12, 13},
- /* unprotected_peer_ids */ {4, 5, 6, 7, 8, 9, 14, 15},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 10, 11, 12, 13},
+ /*unprotected_peer_ids=*/{4, 5, 6, 7, 8, 9, 14, 15},
random_context));
// Combined test: expect having 1 localhost and 4 onion peers out of 16 to
@@ -258,8 +258,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_is_local = (c.id == 15);
c.m_network = (c.id > 6 && c.id < 11) ? NET_ONION : NET_IPV6;
},
- /* protected_peer_ids */ {0, 1, 2, 3, 7, 8, 9, 15},
- /* unprotected_peer_ids */ {5, 6, 10, 11, 12, 13, 14},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 7, 8, 9, 15},
+ /*unprotected_peer_ids=*/{5, 6, 10, 11, 12, 13, 14},
random_context));
// Combined test: expect having 2 onion and 4 I2P out of 12 peers to protect
@@ -277,8 +277,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_network = NET_IPV4;
}
},
- /* protected_peer_ids */ {0, 1, 2, 6, 8, 10},
- /* unprotected_peer_ids */ {3, 4, 5, 7, 9, 11},
+ /*protected_peer_ids=*/{0, 1, 2, 6, 8, 10},
+ /*unprotected_peer_ids=*/{3, 4, 5, 7, 9, 11},
random_context));
// Tests with 3 networks...
@@ -298,8 +298,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_network = NET_IPV6;
}
},
- /* protected_peer_ids */ {0, 4},
- /* unprotected_peer_ids */ {1, 2},
+ /*protected_peer_ids=*/{0, 4},
+ /*unprotected_peer_ids=*/{1, 2},
random_context));
// Combined test: expect having 1 localhost, 1 I2P and 1 onion peer out of 7
@@ -317,8 +317,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_network = NET_IPV6;
}
},
- /* protected_peer_ids */ {0, 1, 6},
- /* unprotected_peer_ids */ {2, 3, 4, 5},
+ /*protected_peer_ids=*/{0, 1, 6},
+ /*unprotected_peer_ids=*/{2, 3, 4, 5},
random_context));
// Combined test: expect having 1 localhost, 1 I2P and 1 onion peer out of 8
@@ -336,8 +336,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_network = NET_IPV6;
}
},
- /* protected_peer_ids */ {0, 1, 5, 6},
- /* unprotected_peer_ids */ {2, 3, 4, 7},
+ /*protected_peer_ids=*/{0, 1, 5, 6},
+ /*unprotected_peer_ids=*/{2, 3, 4, 7},
random_context));
// Combined test: expect having 4 localhost, 2 I2P, and 2 onion peers out of
@@ -355,8 +355,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_network = NET_IPV4;
}
},
- /* protected_peer_ids */ {0, 1, 2, 3, 6, 7, 9, 11},
- /* unprotected_peer_ids */ {4, 5, 8, 10, 12, 13, 14, 15},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 6, 7, 9, 11},
+ /*unprotected_peer_ids=*/{4, 5, 8, 10, 12, 13, 14, 15},
random_context));
// Combined test: expect having 1 localhost, 8 I2P and 1 onion peer out of
@@ -374,8 +374,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_network = NET_IPV6;
}
},
- /* protected_peer_ids */ {0, 1, 2, 3, 4, 5, 12, 15, 16, 17, 18, 23},
- /* unprotected_peer_ids */ {6, 7, 8, 9, 10, 11, 13, 14, 19, 20, 21, 22},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 4, 5, 12, 15, 16, 17, 18, 23},
+ /*unprotected_peer_ids=*/{6, 7, 8, 9, 10, 11, 13, 14, 19, 20, 21, 22},
random_context));
// Combined test: expect having 1 localhost, 3 I2P and 6 onion peers out of
@@ -393,8 +393,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_network = NET_IPV4;
}
},
- /* protected_peer_ids */ {0, 1, 2, 3, 4, 5, 12, 14, 15, 17, 18, 19},
- /* unprotected_peer_ids */ {6, 7, 8, 9, 10, 11, 13, 16, 20, 21, 22, 23},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 4, 5, 12, 14, 15, 17, 18, 19},
+ /*unprotected_peer_ids=*/{6, 7, 8, 9, 10, 11, 13, 16, 20, 21, 22, 23},
random_context));
// Combined test: expect having 1 localhost, 7 I2P and 4 onion peers out of
@@ -412,8 +412,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_network = NET_IPV6;
}
},
- /* protected_peer_ids */ {0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 17, 18},
- /* unprotected_peer_ids */ {6, 7, 8, 9, 10, 11, 16, 19, 20, 21, 22, 23},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 4, 5, 12, 13, 14, 15, 17, 18},
+ /*unprotected_peer_ids=*/{6, 7, 8, 9, 10, 11, 16, 19, 20, 21, 22, 23},
random_context));
// Combined test: expect having 8 localhost, 4 I2P, and 3 onion peers out of
@@ -431,8 +431,8 @@ BOOST_AUTO_TEST_CASE(peer_protection_test)
c.m_network = NET_IPV4;
}
},
- /* protected_peer_ids */ {0, 1, 2, 3, 4, 5, 7, 8, 11, 12, 16, 17},
- /* unprotected_peer_ids */ {6, 9, 10, 13, 14, 15, 18, 19, 20, 21, 22, 23},
+ /*protected_peer_ids=*/{0, 1, 2, 3, 4, 5, 7, 8, 11, 12, 16, 17},
+ /*unprotected_peer_ids=*/{6, 9, 10, 13, 14, 15, 18, 19, 20, 21, 22, 23},
random_context));
}
diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp
index 29938d4ede..c5bd9c73fd 100644
--- a/src/test/net_tests.cpp
+++ b/src/test/net_tests.cpp
@@ -607,7 +607,7 @@ BOOST_AUTO_TEST_CASE(ipv4_peer_with_ipv6_addrMe_test)
in_addr ipv4AddrPeer;
ipv4AddrPeer.s_addr = 0xa0b0c001;
CAddress addr = CAddress(CService(ipv4AddrPeer, 7777), NODE_NETWORK);
- std::unique_ptr<CNode> pnode = std::make_unique<CNode>(0, NODE_NETWORK, INVALID_SOCKET, addr, /* nKeyedNetGroupIn */ 0, /* nLocalHostNonceIn */ 0, CAddress{}, /* pszDest */ std::string{}, ConnectionType::OUTBOUND_FULL_RELAY, /* inbound_onion */ false);
+ std::unique_ptr<CNode> pnode = std::make_unique<CNode>(0, NODE_NETWORK, INVALID_SOCKET, addr, /*nKeyedNetGroupIn=*/0, /*nLocalHostNonceIn=*/0, CAddress{}, /*pszDest=*/std::string{}, ConnectionType::OUTBOUND_FULL_RELAY, /*inbound_onion=*/false);
pnode->fSuccessfullyConnected.store(true);
// the peer claims to be reaching us via IPv6
diff --git a/src/test/scheduler_tests.cpp b/src/test/scheduler_tests.cpp
index d57c000b92..fed941247c 100644
--- a/src/test/scheduler_tests.cpp
+++ b/src/test/scheduler_tests.cpp
@@ -44,7 +44,7 @@ BOOST_AUTO_TEST_CASE(manythreads)
std::mutex counterMutex[10];
int counter[10] = { 0 };
- FastRandomContext rng{/* fDeterministic */ true};
+ FastRandomContext rng{/*fDeterministic=*/true};
auto zeroToNine = [](FastRandomContext& rc) -> int { return rc.randrange(10); }; // [0, 9]
auto randomMsec = [](FastRandomContext& rc) -> int { return -11 + (int)rc.randrange(1012); }; // [-11, 1000]
auto randomDelta = [](FastRandomContext& rc) -> int { return -1000 + (int)rc.randrange(2001); }; // [-1000, 1000]
diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp
index e05781a6f0..6b0614ed97 100644
--- a/src/test/transaction_tests.cpp
+++ b/src/test/transaction_tests.cpp
@@ -249,26 +249,26 @@ BOOST_AUTO_TEST_CASE(tx_valid)
BOOST_ERROR("Bad test flags: " << strTest);
}
- BOOST_CHECK_MESSAGE(CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, ~verify_flags, txdata, strTest, /* expect_valid */ true),
+ BOOST_CHECK_MESSAGE(CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, ~verify_flags, txdata, strTest, /*expect_valid=*/true),
"Tx unexpectedly failed: " << strTest);
// Backwards compatibility of script verification flags: Removing any flag(s) should not invalidate a valid transaction
for (const auto& [name, flag] : mapFlagNames) {
// Removing individual flags
unsigned int flags = TrimFlags(~(verify_flags | flag));
- if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags, txdata, strTest, /* expect_valid */ true)) {
+ if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags, txdata, strTest, /*expect_valid=*/true)) {
BOOST_ERROR("Tx unexpectedly failed with flag " << name << " unset: " << strTest);
}
// Removing random combinations of flags
flags = TrimFlags(~(verify_flags | (unsigned int)InsecureRandBits(mapFlagNames.size())));
- if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags, txdata, strTest, /* expect_valid */ true)) {
+ if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags, txdata, strTest, /*expect_valid=*/true)) {
BOOST_ERROR("Tx unexpectedly failed with random flags " << ToString(flags) << ": " << strTest);
}
}
// Check that flags are maximal: transaction should fail if any unset flags are set.
for (auto flags_excluding_one : ExcludeIndividualFlags(verify_flags)) {
- if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, ~flags_excluding_one, txdata, strTest, /* expect_valid */ false)) {
+ if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, ~flags_excluding_one, txdata, strTest, /*expect_valid=*/false)) {
BOOST_ERROR("Too many flags unset: " << strTest);
}
}
@@ -340,26 +340,26 @@ BOOST_AUTO_TEST_CASE(tx_invalid)
}
// Not using FillFlags() in the main test, in order to detect invalid verifyFlags combination
- BOOST_CHECK_MESSAGE(CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, verify_flags, txdata, strTest, /* expect_valid */ false),
+ BOOST_CHECK_MESSAGE(CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, verify_flags, txdata, strTest, /*expect_valid=*/false),
"Tx unexpectedly passed: " << strTest);
// Backwards compatibility of script verification flags: Adding any flag(s) should not validate an invalid transaction
for (const auto& [name, flag] : mapFlagNames) {
unsigned int flags = FillFlags(verify_flags | flag);
// Adding individual flags
- if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags, txdata, strTest, /* expect_valid */ false)) {
+ if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags, txdata, strTest, /*expect_valid=*/false)) {
BOOST_ERROR("Tx unexpectedly passed with flag " << name << " set: " << strTest);
}
// Adding random combinations of flags
flags = FillFlags(verify_flags | (unsigned int)InsecureRandBits(mapFlagNames.size()));
- if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags, txdata, strTest, /* expect_valid */ false)) {
+ if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags, txdata, strTest, /*expect_valid=*/false)) {
BOOST_ERROR("Tx unexpectedly passed with random flags " << name << ": " << strTest);
}
}
// Check that flags are minimal: transaction should succeed if any set flags are unset.
for (auto flags_excluding_one : ExcludeIndividualFlags(verify_flags)) {
- if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags_excluding_one, txdata, strTest, /* expect_valid */ true)) {
+ if (!CheckTxScripts(tx, mapprevOutScriptPubKeys, mapprevOutValues, flags_excluding_one, txdata, strTest, /*expect_valid=*/true)) {
BOOST_ERROR("Too many flags set: " << strTest);
}
}
diff --git a/src/test/txpackage_tests.cpp b/src/test/txpackage_tests.cpp
index 8d92bee221..2193e21780 100644
--- a/src/test/txpackage_tests.cpp
+++ b/src/test/txpackage_tests.cpp
@@ -84,10 +84,10 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
CScript child_locking_script = GetScriptForDestination(PKHash(child_key.GetPubKey()));
auto mtx_child = CreateValidMempoolTransaction(/*input_transaction=*/ tx_parent, /*input_vout=*/0,
/*input_height=*/ 101, /*input_signing_key=*/parent_key,
- /*output_destination */ child_locking_script,
+ /*output_destination=*/child_locking_script,
/*output_amount=*/ CAmount(48 * COIN), /*submit=*/false);
CTransactionRef tx_child = MakeTransactionRef(mtx_child);
- const auto result_parent_child = ProcessNewPackage(m_node.chainman->ActiveChainstate(), *m_node.mempool, {tx_parent, tx_child}, /* test_accept */ true);
+ const auto result_parent_child = ProcessNewPackage(m_node.chainman->ActiveChainstate(), *m_node.mempool, {tx_parent, tx_child}, /*test_accept=*/true);
BOOST_CHECK_MESSAGE(result_parent_child.m_state.IsValid(),
"Package validation unexpectedly failed: " << result_parent_child.m_state.GetRejectReason());
auto it_parent = result_parent_child.m_tx_results.find(tx_parent->GetWitnessHash());
@@ -103,7 +103,7 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
// A single, giant transaction submitted through ProcessNewPackage fails on single tx policy.
CTransactionRef giant_ptx = create_placeholder_tx(999, 999);
BOOST_CHECK(GetVirtualTransactionSize(*giant_ptx) > MAX_PACKAGE_SIZE * 1000);
- auto result_single_large = ProcessNewPackage(m_node.chainman->ActiveChainstate(), *m_node.mempool, {giant_ptx}, /* test_accept */ true);
+ auto result_single_large = ProcessNewPackage(m_node.chainman->ActiveChainstate(), *m_node.mempool, {giant_ptx}, /*test_accept=*/true);
BOOST_CHECK(result_single_large.m_state.IsInvalid());
BOOST_CHECK_EQUAL(result_single_large.m_state.GetResult(), PackageValidationResult::PCKG_TX);
BOOST_CHECK_EQUAL(result_single_large.m_state.GetRejectReason(), "transaction failed");
diff --git a/src/test/util/chainstate.h b/src/test/util/chainstate.h
index e95573022c..555979d94e 100644
--- a/src/test/util/chainstate.h
+++ b/src/test/util/chainstate.h
@@ -47,7 +47,7 @@ CreateAndActivateUTXOSnapshot(NodeContext& node, const fs::path root, F malleati
malleation(auto_infile, metadata);
- return node.chainman->ActivateSnapshot(auto_infile, metadata, /*in_memory*/ true);
+ return node.chainman->ActivateSnapshot(auto_infile, metadata, /*in_memory=*/true);
}
diff --git a/src/test/util/net.cpp b/src/test/util/net.cpp
index 28d7967078..696fd902f8 100644
--- a/src/test/util/net.cpp
+++ b/src/test/util/net.cpp
@@ -46,18 +46,18 @@ std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(int n_candida
std::vector<NodeEvictionCandidate> candidates;
for (int id = 0; id < n_candidates; ++id) {
candidates.push_back({
- /* id */ id,
- /* nTimeConnected */ static_cast<int64_t>(random_context.randrange(100)),
- /* m_min_ping_time */ std::chrono::microseconds{random_context.randrange(100)},
- /* nLastBlockTime */ static_cast<int64_t>(random_context.randrange(100)),
- /* nLastTXTime */ static_cast<int64_t>(random_context.randrange(100)),
- /* fRelevantServices */ random_context.randbool(),
- /* fRelayTxes */ random_context.randbool(),
- /* fBloomFilter */ random_context.randbool(),
- /* nKeyedNetGroup */ random_context.randrange(100),
- /* prefer_evict */ random_context.randbool(),
- /* m_is_local */ random_context.randbool(),
- /* m_network */ ALL_NETWORKS[random_context.randrange(ALL_NETWORKS.size())],
+ /*id=*/id,
+ /*nTimeConnected=*/static_cast<int64_t>(random_context.randrange(100)),
+ /*m_min_ping_time=*/std::chrono::microseconds{random_context.randrange(100)},
+ /*nLastBlockTime=*/static_cast<int64_t>(random_context.randrange(100)),
+ /*nLastTXTime=*/static_cast<int64_t>(random_context.randrange(100)),
+ /*fRelevantServices=*/random_context.randbool(),
+ /*fRelayTxes=*/random_context.randbool(),
+ /*fBloomFilter=*/random_context.randbool(),
+ /*nKeyedNetGroup=*/random_context.randrange(100),
+ /*prefer_evict=*/random_context.randbool(),
+ /*m_is_local=*/random_context.randbool(),
+ /*m_network=*/ALL_NETWORKS[random_context.randrange(ALL_NETWORKS.size())],
});
}
return candidates;
diff --git a/src/test/util/setup_common.cpp b/src/test/util/setup_common.cpp
index cdb8238095..f5cc88f4ce 100644
--- a/src/test/util/setup_common.cpp
+++ b/src/test/util/setup_common.cpp
@@ -179,7 +179,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
m_node.chainman->InitializeChainstate(m_node.mempool.get());
m_node.chainman->ActiveChainstate().InitCoinsDB(
- /* cache_size_bytes */ 1 << 23, /* in_memory */ true, /* should_wipe */ false);
+ /*cache_size_bytes=*/1 << 23, /*in_memory=*/true, /*should_wipe=*/false);
assert(!m_node.chainman->ActiveChainstate().CanFlushToDisk());
m_node.chainman->ActiveChainstate().InitCoinsCache(1 << 23);
assert(m_node.chainman->ActiveChainstate().CanFlushToDisk());
@@ -192,7 +192,7 @@ 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, /*consistency_check_ratio=*/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,
diff --git a/src/test/util/setup_common.h b/src/test/util/setup_common.h
index eb7bc071e5..4f2ccb6ebb 100644
--- a/src/test/util/setup_common.h
+++ b/src/test/util/setup_common.h
@@ -56,7 +56,7 @@ void Seed(FastRandomContext& ctx);
static inline void SeedInsecureRand(SeedRand seed = SeedRand::SEED)
{
if (seed == SeedRand::ZEROS) {
- g_insecure_rand_ctx = FastRandomContext(/* deterministic */ true);
+ g_insecure_rand_ctx = FastRandomContext(/*fDeterministic=*/true);
} else {
Seed(g_insecure_rand_ctx);
}
diff --git a/src/test/validation_chainstate_tests.cpp b/src/test/validation_chainstate_tests.cpp
index 9bb08f774f..b890ae4931 100644
--- a/src/test/validation_chainstate_tests.cpp
+++ b/src/test/validation_chainstate_tests.cpp
@@ -41,7 +41,7 @@ BOOST_AUTO_TEST_CASE(validation_chainstate_resize_caches)
CChainState& c1 = WITH_LOCK(cs_main, return manager.InitializeChainstate(&mempool));
c1.InitCoinsDB(
- /* cache_size_bytes */ 1 << 23, /* in_memory */ true, /* should_wipe */ false);
+ /*cache_size_bytes=*/1 << 23, /*in_memory=*/true, /*should_wipe=*/false);
WITH_LOCK(::cs_main, c1.InitCoinsCache(1 << 23));
// Add a coin to the in-memory cache, upsize once, then downsize.
diff --git a/src/test/validation_chainstatemanager_tests.cpp b/src/test/validation_chainstatemanager_tests.cpp
index be9e05a65e..a1f70e7e70 100644
--- a/src/test/validation_chainstatemanager_tests.cpp
+++ b/src/test/validation_chainstatemanager_tests.cpp
@@ -39,7 +39,7 @@ BOOST_AUTO_TEST_CASE(chainstatemanager)
CChainState& c1 = WITH_LOCK(::cs_main, return manager.InitializeChainstate(&mempool));
chainstates.push_back(&c1);
c1.InitCoinsDB(
- /* cache_size_bytes */ 1 << 23, /* in_memory */ true, /* should_wipe */ false);
+ /*cache_size_bytes=*/1 << 23, /*in_memory=*/true, /*should_wipe=*/false);
WITH_LOCK(::cs_main, c1.InitCoinsCache(1 << 23));
BOOST_CHECK(!manager.IsSnapshotActive());
@@ -68,7 +68,7 @@ BOOST_AUTO_TEST_CASE(chainstatemanager)
BOOST_CHECK_EQUAL(manager.SnapshotBlockhash().value(), snapshot_blockhash);
c2.InitCoinsDB(
- /* cache_size_bytes */ 1 << 23, /* in_memory */ true, /* should_wipe */ false);
+ /*cache_size_bytes=*/1 << 23, /*in_memory=*/true, /*should_wipe=*/false);
WITH_LOCK(::cs_main, c2.InitCoinsCache(1 << 23));
// Unlike c1, which doesn't have any blocks. Gets us different tip, height.
c2.LoadGenesisBlock();
@@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(chainstatemanager_rebalance_caches)
CChainState& c1 = WITH_LOCK(cs_main, return manager.InitializeChainstate(&mempool));
chainstates.push_back(&c1);
c1.InitCoinsDB(
- /* cache_size_bytes */ 1 << 23, /* in_memory */ true, /* should_wipe */ false);
+ /*cache_size_bytes=*/1 << 23, /*in_memory=*/true, /*should_wipe=*/false);
{
LOCK(::cs_main);
@@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(chainstatemanager_rebalance_caches)
CChainState& c2 = WITH_LOCK(cs_main, return manager.InitializeChainstate(&mempool, GetRandHash()));
chainstates.push_back(&c2);
c2.InitCoinsDB(
- /* cache_size_bytes */ 1 << 23, /* in_memory */ true, /* should_wipe */ false);
+ /*cache_size_bytes=*/1 << 23, /*in_memory=*/true, /*should_wipe=*/false);
{
LOCK(::cs_main);
diff --git a/src/test/validation_flush_tests.cpp b/src/test/validation_flush_tests.cpp
index 9136c497ea..b4daceb72c 100644
--- a/src/test/validation_flush_tests.cpp
+++ b/src/test/validation_flush_tests.cpp
@@ -21,7 +21,7 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
CTxMemPool mempool;
BlockManager blockman{};
CChainState chainstate{&mempool, blockman, *Assert(m_node.chainman)};
- chainstate.InitCoinsDB(/*cache_size_bytes*/ 1 << 10, /*in_memory*/ true, /*should_wipe*/ false);
+ chainstate.InitCoinsDB(/*cache_size_bytes=*/1 << 10, /*in_memory=*/true, /*should_wipe=*/false);
WITH_LOCK(::cs_main, chainstate.InitCoinsCache(1 << 10));
constexpr bool is_64_bit = sizeof(void*) == 8;
@@ -56,7 +56,7 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
// Without any coins in the cache, we shouldn't need to flush.
BOOST_CHECK_EQUAL(
- chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes*/ 0),
+ chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes=*/0),
CoinsCacheSizeState::OK);
// If the initial memory allocations of cacheCoins don't match these common
@@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
}
BOOST_CHECK_EQUAL(
- chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes*/ 0),
+ chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes=*/0),
CoinsCacheSizeState::CRITICAL);
BOOST_TEST_MESSAGE("Exiting cache flush tests early due to unsupported arch");
@@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
print_view_mem_usage(view);
BOOST_CHECK_EQUAL(view.AccessCoin(res).DynamicMemoryUsage(), COIN_SIZE);
BOOST_CHECK_EQUAL(
- chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes*/ 0),
+ chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes=*/0),
CoinsCacheSizeState::OK);
}
@@ -100,26 +100,26 @@ BOOST_AUTO_TEST_CASE(getcoinscachesizestate)
for (int i{0}; i < 4; ++i) {
add_coin(view);
print_view_mem_usage(view);
- if (chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes*/ 0) ==
+ if (chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes=*/0) ==
CoinsCacheSizeState::CRITICAL) {
break;
}
}
BOOST_CHECK_EQUAL(
- chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes*/ 0),
+ chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes=*/0),
CoinsCacheSizeState::CRITICAL);
// Passing non-zero max mempool usage should allow us more headroom.
BOOST_CHECK_EQUAL(
- chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes*/ 1 << 10),
+ chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes=*/1 << 10),
CoinsCacheSizeState::OK);
for (int i{0}; i < 3; ++i) {
add_coin(view);
print_view_mem_usage(view);
BOOST_CHECK_EQUAL(
- chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes*/ 1 << 10),
+ chainstate.GetCoinsCacheSizeState(MAX_COINS_CACHE_BYTES, /*max_mempool_size_bytes=*/1 << 10),
CoinsCacheSizeState::OK);
}
diff --git a/src/wallet/test/coinselector_tests.cpp b/src/wallet/test/coinselector_tests.cpp
index 8f985f31ee..0acd8a811f 100644
--- a/src/wallet/test/coinselector_tests.cpp
+++ b/src/wallet/test/coinselector_tests.cpp
@@ -133,7 +133,7 @@ inline std::vector<OutputGroup>& KnapsackGroupOutputs(const std::vector<COutput>
/* long_term_feerate= */ CFeeRate(0), /* discard_feerate= */ CFeeRate(0),
/* tx_noinputs_size= */ 0, /* avoid_partial= */ false);
static std::vector<OutputGroup> static_groups;
- static_groups = GroupOutputs(wallet, coins, coin_selection_params, filter, /* positive_only */false);
+ static_groups = GroupOutputs(wallet, coins, coin_selection_params, filter, /*positive_only=*/false);
return static_groups;
}
@@ -733,7 +733,7 @@ BOOST_AUTO_TEST_CASE(waste_test)
add_coin(1 * COIN, 1, selection, fee, fee);
add_coin(2 * COIN, 2, selection, fee, fee);
const CAmount exact_target{in_amt - fee * 2};
- BOOST_CHECK_EQUAL(0, GetSelectionWaste(selection, /* change_cost */ 0, exact_target));
+ BOOST_CHECK_EQUAL(0, GetSelectionWaste(selection, /*change_cost=*/0, exact_target));
selection.clear();
// No Waste when (fee - long_term_fee) == (-cost_of_change), and no excess