From a73a3ec5532ddc05c1b013d868d9994f2889c9cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C5=91rinc?= Date: Sat, 24 Jan 2026 00:12:07 +0100 Subject: [PATCH] doc: fix invalid arg name hints for bugprone validation The extra leading `=` or missing trailing `=` prevented clang-tidy's `bugprone-argument-comment` check from validating the parameter name, as it only matches comments formatted strictly as `/*arg=*/` (see https://clang.llvm.org/extra/clang-tidy/checks/bugprone/argument-comment.html). --- src/bench/mempool_stress.cpp | 4 +- src/node/interfaces.cpp | 2 +- src/rpc/mempool.cpp | 2 +- src/test/headers_sync_chainwork_tests.cpp | 18 ++--- src/test/rbf_tests.cpp | 2 +- src/validation.cpp | 80 +++++++++++------------ src/wallet/rpc/wallet.cpp | 2 +- src/wallet/spend.cpp | 2 +- src/wallet/test/coinselection_tests.cpp | 2 +- src/wallet/test/coinselector_tests.cpp | 4 +- src/wallet/test/wallet_tests.cpp | 2 +- src/wallet/wallet.cpp | 4 +- 12 files changed, 62 insertions(+), 62 deletions(-) diff --git a/src/bench/mempool_stress.cpp b/src/bench/mempool_stress.cpp index 768913ac12a..9cddeb7815f 100644 --- a/src/bench/mempool_stress.cpp +++ b/src/bench/mempool_stress.cpp @@ -106,7 +106,7 @@ static void MemPoolAddTransactions(benchmark::Bench& bench) std::vector transactions; // Create 1000 clusters of 100 transactions each for (int i=0; i<100; i++) { - auto new_txs = CreateCoinCluster(det_rand, childTxs, /*min_ancestors*/ 1); + auto new_txs = CreateCoinCluster(det_rand, childTxs, /*min_ancestors=*/ 1); transactions.insert(transactions.end(), new_txs.begin(), new_txs.end()); } @@ -156,7 +156,7 @@ static void ComplexMemPool(benchmark::Bench& bench) // in the same state at the end of the function, so we benchmark both // mining a block and reorging the block's contents back into the mempool. bench.run([&]() NO_THREAD_SAFETY_ANALYSIS { - pool.removeForBlock(tx_remove_for_block, /*nBlockHeight*/100); + pool.removeForBlock(tx_remove_for_block, /*nBlockHeight=*/100); for (auto& tx: tx_remove_for_block) { AddTx(tx, pool, det_rand); } diff --git a/src/node/interfaces.cpp b/src/node/interfaces.cpp index 366bd608481..37524176e20 100644 --- a/src/node/interfaces.cpp +++ b/src/node/interfaces.cpp @@ -980,7 +980,7 @@ public: bool checkBlock(const CBlock& block, const node::BlockCheckOptions& options, std::string& reason, std::string& debug) override { LOCK(chainman().GetMutex()); - BlockValidationState state{TestBlockValidity(chainman().ActiveChainstate(), block, /*check_pow=*/options.check_pow, /*=check_merkle_root=*/options.check_merkle_root)}; + BlockValidationState state{TestBlockValidity(chainman().ActiveChainstate(), block, /*check_pow=*/options.check_pow, /*check_merkle_root=*/options.check_merkle_root)}; reason = state.GetRejectReason(); debug = state.GetDebugMessage(); return state.IsValid(); diff --git a/src/rpc/mempool.cpp b/src/rpc/mempool.cpp index 7657910512a..66ce1c61582 100644 --- a/src/rpc/mempool.cpp +++ b/src/rpc/mempool.cpp @@ -1084,7 +1084,7 @@ static RPCHelpMan getorphantxs() PeerManager& peerman = EnsurePeerman(node); std::vector orphanage = peerman.GetOrphanTransactions(); - int verbosity{ParseVerbosity(request.params[0], /*default_verbosity=*/0, /*allow_bool*/false)}; + int verbosity{ParseVerbosity(request.params[0], /*default_verbosity=*/0, /*allow_bool=*/false)}; UniValue ret(UniValue::VARR); diff --git a/src/test/headers_sync_chainwork_tests.cpp b/src/test/headers_sync_chainwork_tests.cpp index b6a5e153e51..f9426fa3114 100644 --- a/src/test/headers_sync_chainwork_tests.cpp +++ b/src/test/headers_sync_chainwork_tests.cpp @@ -153,7 +153,7 @@ BOOST_AUTO_TEST_CASE(sneaky_redownload) // Pretend the message is still "full", so we don't abort. CHECK_RESULT(hss.ProcessNextHeaders({{first_chain.front()}}, /*full_headers_message=*/true), hss, /*exp_state=*/State::PRESYNC, - /*exp_success*/true, /*exp_request_more=*/true, + /*exp_success=*/true, /*exp_request_more=*/true, /*exp_headers_size=*/0, /*exp_pow_validated_prev=*/std::nullopt, /*exp_locator_hash=*/first_chain.front().GetHash()); @@ -161,7 +161,7 @@ BOOST_AUTO_TEST_CASE(sneaky_redownload) // requirement during PRESYNC and transitioned to REDOWNLOAD. CHECK_RESULT(hss.ProcessNextHeaders(std::span{first_chain}.subspan(1), true), hss, /*exp_state=*/State::REDOWNLOAD, - /*exp_success*/true, /*exp_request_more=*/true, + /*exp_success=*/true, /*exp_request_more=*/true, /*exp_headers_size=*/0, /*exp_pow_validated_prev=*/std::nullopt, /*exp_locator_hash=*/genesis.GetHash()); @@ -173,7 +173,7 @@ BOOST_AUTO_TEST_CASE(sneaky_redownload) // Try to sneakily feed back the second chain during REDOWNLOAD. CHECK_RESULT(hss.ProcessNextHeaders(second_chain, true), hss, /*exp_state=*/State::FINAL, - /*exp_success*/false, // Foiled! We detected mismatching headers. + /*exp_success=*/false, // Foiled! We detected mismatching headers. /*exp_request_more=*/false, /*exp_headers_size=*/0, /*exp_pow_validated_prev=*/std::nullopt, /*exp_locator_hash=*/std::nullopt); @@ -192,7 +192,7 @@ BOOST_AUTO_TEST_CASE(happy_path) const auto genesis_hash{genesis.GetHash()}; CHECK_RESULT(hss.ProcessNextHeaders(first_chain, full_headers_message), hss, /*exp_state=*/State::REDOWNLOAD, - /*exp_success*/true, /*exp_request_more=*/true, + /*exp_success=*/true, /*exp_request_more=*/true, /*exp_headers_size=*/0, /*exp_pow_validated_prev=*/std::nullopt, /*exp_locator_hash=*/genesis_hash); @@ -200,14 +200,14 @@ BOOST_AUTO_TEST_CASE(happy_path) // validated headers shouldn't be returned yet: CHECK_RESULT(hss.ProcessNextHeaders({first_chain.begin(), REDOWNLOAD_BUFFER_SIZE}, true), hss, /*exp_state=*/State::REDOWNLOAD, - /*exp_success*/true, /*exp_request_more=*/true, + /*exp_success=*/true, /*exp_request_more=*/true, /*exp_headers_size=*/0, /*exp_pow_validated_prev=*/std::nullopt, /*exp_locator_hash=*/first_chain[REDOWNLOAD_BUFFER_SIZE - 1].GetHash()); // We start receiving headers for permanent storage before completing: CHECK_RESULT(hss.ProcessNextHeaders({{first_chain[REDOWNLOAD_BUFFER_SIZE]}}, true), hss, /*exp_state=*/State::REDOWNLOAD, - /*exp_success*/true, /*exp_request_more=*/true, + /*exp_success=*/true, /*exp_request_more=*/true, /*exp_headers_size=*/1, /*exp_pow_validated_prev=*/genesis_hash, /*exp_locator_hash=*/first_chain[REDOWNLOAD_BUFFER_SIZE].GetHash()); @@ -215,7 +215,7 @@ BOOST_AUTO_TEST_CASE(happy_path) // completing the REDOWNLOAD phase: CHECK_RESULT(hss.ProcessNextHeaders({first_chain.begin() + REDOWNLOAD_BUFFER_SIZE + 1, first_chain.end()}, full_headers_message), hss, /*exp_state=*/State::FINAL, - /*exp_success*/true, /*exp_request_more=*/false, + /*exp_success=*/true, /*exp_request_more=*/false, // All headers except the one already returned above: /*exp_headers_size=*/first_chain.size() - 1, /*exp_pow_validated_prev=*/first_chain.front().GetHash(), /*exp_locator_hash=*/std::nullopt); @@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE(too_little_work) // Pretend just the first message is "full", so we don't abort. CHECK_RESULT(hss.ProcessNextHeaders({{second_chain.front()}}, true), hss, /*exp_state=*/State::PRESYNC, - /*exp_success*/true, /*exp_request_more=*/true, + /*exp_success=*/true, /*exp_request_more=*/true, /*exp_headers_size=*/0, /*exp_pow_validated_prev=*/std::nullopt, /*exp_locator_hash=*/second_chain.front().GetHash()); @@ -245,7 +245,7 @@ BOOST_AUTO_TEST_CASE(too_little_work) hss, /*exp_state=*/State::FINAL, // Nevertheless, no validation errors should have been detected with the // chain: - /*exp_success*/true, + /*exp_success=*/true, /*exp_request_more=*/false, /*exp_headers_size=*/0, /*exp_pow_validated_prev=*/std::nullopt, /*exp_locator_hash=*/std::nullopt); diff --git a/src/test/rbf_tests.cpp b/src/test/rbf_tests.cpp index 175ca82e946..0ffe0846c25 100644 --- a/src/test/rbf_tests.cpp +++ b/src/test/rbf_tests.cpp @@ -221,7 +221,7 @@ BOOST_FIXTURE_TEST_CASE(rbf_conflicts_calculator, TestChain100Setup) dummy.clear(); // If we mine the parent_tx's, then the clusters split (102 clusters). - pool.removeForBlock({parent_tx_1, parent_tx_2}, /* dummy */ 1); + pool.removeForBlock({parent_tx_1, parent_tx_2}, /*nBlockHeight=*/ 1); // Add some descendants now to each of the direct children (we can do this now that the clusters have split). for (const auto& child : direct_children) { diff --git a/src/validation.cpp b/src/validation.cpp index e919552ad23..bb92e51e6a0 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -484,63 +484,63 @@ public: static ATMPArgs SingleAccept(const CChainParams& chainparams, int64_t accept_time, bool bypass_limits, std::vector& coins_to_uncache, bool test_accept) { - return ATMPArgs{/* m_chainparams */ chainparams, - /* m_accept_time */ accept_time, - /* m_bypass_limits */ bypass_limits, - /* m_coins_to_uncache */ coins_to_uncache, - /* m_test_accept */ test_accept, - /* m_allow_replacement */ true, - /* m_allow_sibling_eviction */ true, - /* m_package_submission */ false, - /* m_package_feerates */ false, - /* m_client_maxfeerate */ {}, // checked by caller + return ATMPArgs{/*chainparams=*/ chainparams, + /*accept_time=*/ accept_time, + /*bypass_limits=*/ bypass_limits, + /*coins_to_uncache=*/ coins_to_uncache, + /*test_accept=*/ test_accept, + /*allow_replacement=*/ true, + /*allow_sibling_eviction=*/ true, + /*package_submission=*/ false, + /*package_feerates=*/ false, + /*client_maxfeerate=*/ {}, // checked by caller }; } /** Parameters for test package mempool validation through testmempoolaccept. */ static ATMPArgs PackageTestAccept(const CChainParams& chainparams, int64_t accept_time, std::vector& coins_to_uncache) { - return ATMPArgs{/* m_chainparams */ chainparams, - /* m_accept_time */ accept_time, - /* m_bypass_limits */ false, - /* m_coins_to_uncache */ coins_to_uncache, - /* m_test_accept */ true, - /* m_allow_replacement */ false, - /* m_allow_sibling_eviction */ false, - /* m_package_submission */ false, // not submitting to mempool - /* m_package_feerates */ false, - /* m_client_maxfeerate */ {}, // checked by caller + return ATMPArgs{/*chainparams=*/ chainparams, + /*accept_time=*/ accept_time, + /*bypass_limits=*/ false, + /*coins_to_uncache=*/ coins_to_uncache, + /*test_accept=*/ true, + /*allow_replacement=*/ false, + /*allow_sibling_eviction=*/ false, + /*package_submission=*/ false, // not submitting to mempool + /*package_feerates=*/ false, + /*client_maxfeerate=*/ {}, // checked by caller }; } /** Parameters for child-with-parents package validation. */ static ATMPArgs PackageChildWithParents(const CChainParams& chainparams, int64_t accept_time, std::vector& coins_to_uncache, const std::optional& client_maxfeerate) { - return ATMPArgs{/* m_chainparams */ chainparams, - /* m_accept_time */ accept_time, - /* m_bypass_limits */ false, - /* m_coins_to_uncache */ coins_to_uncache, - /* m_test_accept */ false, - /* m_allow_replacement */ true, - /* m_allow_sibling_eviction */ false, - /* m_package_submission */ true, - /* m_package_feerates */ true, - /* m_client_maxfeerate */ client_maxfeerate, + return ATMPArgs{/*chainparams=*/ chainparams, + /*accept_time=*/ accept_time, + /*bypass_limits=*/ false, + /*coins_to_uncache=*/ coins_to_uncache, + /*test_accept=*/ false, + /*allow_replacement=*/ true, + /*allow_sibling_eviction=*/ false, + /*package_submission=*/ true, + /*package_feerates=*/ true, + /*client_maxfeerate=*/ client_maxfeerate, }; } /** Parameters for a single transaction within a package. */ static ATMPArgs SingleInPackageAccept(const ATMPArgs& package_args) { - return ATMPArgs{/* m_chainparams */ package_args.m_chainparams, - /* m_accept_time */ package_args.m_accept_time, - /* m_bypass_limits */ false, - /* m_coins_to_uncache */ package_args.m_coins_to_uncache, - /* m_test_accept */ package_args.m_test_accept, - /* m_allow_replacement */ true, - /* m_allow_sibling_eviction */ true, - /* m_package_submission */ true, // trim at the end of AcceptPackage() - /* m_package_feerates */ false, // only 1 transaction - /* m_client_maxfeerate */ package_args.m_client_maxfeerate, + return ATMPArgs{/*chainparams=*/ package_args.m_chainparams, + /*accept_time=*/ package_args.m_accept_time, + /*bypass_limits=*/ false, + /*coins_to_uncache=*/ package_args.m_coins_to_uncache, + /*test_accept=*/ package_args.m_test_accept, + /*allow_replacement=*/ true, + /*allow_sibling_eviction=*/ true, + /*package_submission=*/ true, // trim at the end of AcceptPackage() + /*package_feerates=*/ false, // only 1 transaction + /*client_maxfeerate=*/ package_args.m_client_maxfeerate, }; } diff --git a/src/wallet/rpc/wallet.cpp b/src/wallet/rpc/wallet.cpp index 49808a8d696..fc84b951344 100644 --- a/src/wallet/rpc/wallet.cpp +++ b/src/wallet/rpc/wallet.cpp @@ -530,7 +530,7 @@ RPCHelpMan simulaterawtransaction() for (size_t i = 0; i < txs.size(); ++i) { CMutableTransaction mtx; - if (!DecodeHexTx(mtx, txs[i].get_str(), /* try_no_witness */ true, /* try_witness */ true)) { + if (!DecodeHexTx(mtx, txs[i].get_str(), /*try_no_witness=*/ true, /*try_witness=*/ true)) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Transaction hex string decoding failure."); } diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index b36514120f7..e4ac98bb25c 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -903,7 +903,7 @@ util::Result AutomaticCoinSelection(const CWallet& wallet, Coin // Try with unsafe inputs if they are allowed. This may spend unconfirmed outputs // received from other wallets. if (coin_selection_params.m_include_unsafe_inputs) { - ordered_filters.push_back({CoinEligibilityFilter(/*conf_mine=*/0, /*conf_theirs*/0, max_ancestors-1, max_descendants-1, /*include_partial=*/true)}); + ordered_filters.push_back({CoinEligibilityFilter(/*conf_mine=*/0, /*conf_theirs=*/0, max_ancestors-1, max_descendants-1, /*include_partial=*/true)}); } // Try with unlimited ancestors/descendants. The transaction will still need to meet // mempool ancestor/descendant policy to be accepted to mempool and broadcasted, but diff --git a/src/wallet/test/coinselection_tests.cpp b/src/wallet/test/coinselection_tests.cpp index 05ee6ab457c..6aa473bc260 100644 --- a/src/wallet/test/coinselection_tests.cpp +++ b/src/wallet/test/coinselection_tests.cpp @@ -24,7 +24,7 @@ static const int P2WPKH_OUTPUT_VSIZE = 31; static CoinSelectionParams init_default_params() { CoinSelectionParams dcsp{ - /*rng_fast*/default_rand, + /*rng_fast=*/default_rand, /*change_output_size=*/P2WPKH_OUTPUT_VSIZE, /*change_spend_size=*/P2WPKH_INPUT_VSIZE, /*min_change_target=*/50'000, diff --git a/src/wallet/test/coinselector_tests.cpp b/src/wallet/test/coinselector_tests.cpp index 5c047bad02a..f15eeea8a88 100644 --- a/src/wallet/test/coinselector_tests.cpp +++ b/src/wallet/test/coinselector_tests.cpp @@ -277,14 +277,14 @@ BOOST_AUTO_TEST_CASE(bnb_search_test) add_coin(available_coins, *wallet, 1 * CENT, coin_selection_params_bnb.m_effective_feerate, 6 * 24, false, 0, true); CAmount selection_target = 16 * CENT; - const auto& no_res = SelectCoinsBnB(GroupCoins(available_coins.All(), /*subtract_fee_outputs*/true), + const auto& no_res = SelectCoinsBnB(GroupCoins(available_coins.All(), /*subtract_fee_outputs=*/true), selection_target, /*cost_of_change=*/0, MAX_STANDARD_TX_WEIGHT); BOOST_REQUIRE(!no_res); BOOST_CHECK(util::ErrorString(no_res).original.find("The inputs size exceeds the maximum weight") != std::string::npos); // Now add same coin value with a good size and check that it gets selected add_coin(available_coins, *wallet, 5 * CENT, coin_selection_params_bnb.m_effective_feerate, 6 * 24, false, 0, true); - const auto& res = SelectCoinsBnB(GroupCoins(available_coins.All(), /*subtract_fee_outputs*/true), selection_target, /*cost_of_change=*/0); + const auto& res = SelectCoinsBnB(GroupCoins(available_coins.All(), /*subtract_fee_outputs=*/true), selection_target, /*cost_of_change=*/0); expected_result.Clear(); add_coin(8 * CENT, 2, expected_result); diff --git a/src/wallet/test/wallet_tests.cpp b/src/wallet/test/wallet_tests.cpp index 85f8dfc3b9a..253e4dd65ae 100644 --- a/src/wallet/test/wallet_tests.cpp +++ b/src/wallet/test/wallet_tests.cpp @@ -332,7 +332,7 @@ BOOST_FIXTURE_TEST_CASE(LoadReceiveRequests, TestingSetup) auto requests = wallet->GetAddressReceiveRequests(); auto erequests = {"val_rr11", "val_rr20"}; BOOST_CHECK_EQUAL_COLLECTIONS(requests.begin(), requests.end(), std::begin(erequests), std::end(erequests)); - RunWithinTxn(wallet->GetDatabase(), /*process_desc*/"test", [](WalletBatch& batch){ + RunWithinTxn(wallet->GetDatabase(), /*process_desc=*/"test", [](WalletBatch& batch){ BOOST_CHECK(batch.WriteAddressPreviouslySpent(PKHash(), false)); BOOST_CHECK(batch.EraseAddressData(ScriptHash())); return true; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index bc27018cd2f..de260f8e49d 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4169,7 +4169,7 @@ bool DoMigration(CWallet& wallet, WalletContext& context, bilingual_str& error, // Parse the descriptor FlatSigningProvider keys; std::string parse_err; - std::vector> descs = Parse(desc_str, keys, parse_err, /* require_checksum */ true); + std::vector> descs = Parse(desc_str, keys, parse_err, /*require_checksum=*/ true); assert(descs.size() == 1); // It shouldn't be possible to have the LegacyScriptPubKeyMan make an invalid descriptor or a multipath descriptors assert(!descs.at(0)->IsRange()); // It shouldn't be possible to have LegacyScriptPubKeyMan make a ranged watchonly descriptor @@ -4208,7 +4208,7 @@ bool DoMigration(CWallet& wallet, WalletContext& context, bilingual_str& error, // Parse the descriptor FlatSigningProvider keys; std::string parse_err; - std::vector> descs = Parse(desc_str, keys, parse_err, /* require_checksum */ true); + std::vector> descs = Parse(desc_str, keys, parse_err, /*require_checksum=*/ true); assert(descs.size() == 1); // It shouldn't be possible to have the LegacyScriptPubKeyMan make an invalid descriptor or a multipath descriptors assert(!descs.at(0)->IsRange()); // It shouldn't be possible to have LegacyScriptPubKeyMan make a ranged watchonly descriptor