Skip to content

Commit 606e306

Browse files
committed
Merge bitcoin/bitcoin#22981: doc: Fix incorrect C++ named args
fac4947 doc: Fix incorrect C++ named args (MarcoFalke) Pull request description: Incorrect named args are source of bugs, like #22979. Fix that by correcting them and adjust the format, so that clang-tidy can check it. ACKs for top commit: fanquake: ACK fac4947 - `run-clang-tidy` works for me now. Tree-SHA512: 2694e17a1586394baf30bbc479a913e4bad361221e8470b8739caf30aacea736befc73820f3fe56f6207d9f5d969323278d43a647f58c3497e8e44cad79f8934
2 parents 2ef186a + fac4947 commit 606e306

File tree

10 files changed

+29
-29
lines changed

10 files changed

+29
-29
lines changed

src/bench/rpc_mempool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
static void AddTx(const CTransactionRef& tx, const CAmount& fee, CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(cs_main, pool.cs)
1313
{
1414
LockPoints lp;
15-
pool.addUnchecked(CTxMemPoolEntry(tx, fee, /* time */ 0, /* height */ 1, /* spendsCoinbase */ false, /* sigOpCost */ 4, lp));
15+
pool.addUnchecked(CTxMemPoolEntry(tx, fee, /*time=*/0, /*entry_height=*/1, /*spends_coinbase=*/false, /*sigops_cost=*/4, lp));
1616
}
1717

1818
static void RpcMempool(benchmark::Bench& bench)

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3024,7 +3024,7 @@ void CConnman::PushMessage(CNode* pnode, CSerializedNetMsg&& msg)
30243024
size_t nMessageSize = msg.data.size();
30253025
LogPrint(BCLog::NET, "sending %s (%d bytes) peer=%d\n", msg.m_type, nMessageSize, pnode->GetId());
30263026
if (gArgs.GetBoolArg("-capturemessages", false)) {
3027-
CaptureMessage(pnode->addr, msg.m_type, msg.data, /* incoming */ false);
3027+
CaptureMessage(pnode->addr, msg.m_type, msg.data, /*is_incoming=*/false);
30283028
}
30293029

30303030
TRACE6(net, outbound_message,

src/net_processing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4105,7 +4105,7 @@ bool PeerManagerImpl::ProcessMessages(CNode* pfrom, std::atomic<bool>& interrupt
41054105
);
41064106

41074107
if (gArgs.GetBoolArg("-capturemessages", false)) {
4108-
CaptureMessage(pfrom->addr, msg.m_command, MakeUCharSpan(msg.m_recv), /* incoming */ true);
4108+
CaptureMessage(pfrom->addr, msg.m_command, MakeUCharSpan(msg.m_recv), /*is_incoming=*/true);
41094109
}
41104110

41114111
msg.SetVersion(pfrom->GetCommonVersion());

src/qt/test/test_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
6969
#if defined(WIN32)
7070
if (getenv("QT_QPA_PLATFORM") == nullptr) _putenv_s("QT_QPA_PLATFORM", "minimal");
7171
#else
72-
setenv("QT_QPA_PLATFORM", "minimal", /* overwrite */ 0);
72+
setenv("QT_QPA_PLATFORM", "minimal", 0 /* overwrite */);
7373
#endif
7474

7575
// Don't remove this, it's needed to access

src/rpc/mining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ static RPCHelpMan submitblock()
10101010
bool new_block;
10111011
auto sc = std::make_shared<submitblock_StateCatcher>(block.GetHash());
10121012
RegisterSharedValidationInterface(sc);
1013-
bool accepted = chainman.ProcessNewBlock(Params(), blockptr, /* fForceProcessing */ true, /* fNewBlock */ &new_block);
1013+
bool accepted = chainman.ProcessNewBlock(Params(), blockptr, /*force_processing=*/true, /*new_block=*/&new_block);
10141014
UnregisterSharedValidationInterface(sc);
10151015
if (!new_block && accepted) {
10161016
return "duplicate";

src/rpc/rawtransaction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ static RPCHelpMan utxoupdatepsbt()
16191619
}
16201620
}
16211621
// We don't actually need private keys further on; hide them as a precaution.
1622-
HidingSigningProvider public_provider(&provider, /* nosign */ true, /* nobip32derivs */ false);
1622+
HidingSigningProvider public_provider(&provider, /*hide_secret=*/true, /*hide_origin=*/false);
16231623

16241624
// Fetch previous transactions (inputs):
16251625
CCoinsView viewDummy;
@@ -1658,7 +1658,7 @@ static RPCHelpMan utxoupdatepsbt()
16581658
// Update script/keypath information using descriptor data.
16591659
// Note that SignPSBTInput does a lot more than just constructing ECDSA signatures
16601660
// we don't actually care about those here, in fact.
1661-
SignPSBTInput(public_provider, psbtx, i, &txdata, /* sighash_type */ 1);
1661+
SignPSBTInput(public_provider, psbtx, i, &txdata, /*sighash=*/1);
16621662
}
16631663

16641664
// Update script/keypath information using descriptor data.

src/test/denialofservice_tests.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
5959

6060
// Mock an outbound peer
6161
CAddress addr1(ip(0xa0b0c001), NODE_NONE);
62-
CNode dummyNode1(id++, ServiceFlags(NODE_NETWORK | NODE_WITNESS), INVALID_SOCKET, addr1, /* nKeyedNetGroupIn */ 0, /* nLocalHostNonceIn */ 0, CAddress(), /* pszDest */ "", ConnectionType::OUTBOUND_FULL_RELAY, /* inbound_onion */ false);
62+
CNode dummyNode1(id++, ServiceFlags(NODE_NETWORK | NODE_WITNESS), INVALID_SOCKET, addr1, /*nKeyedNetGroupIn=*/0, /*nLocalHostNonceIn=*/0, CAddress(), /*addrNameIn=*/"", ConnectionType::OUTBOUND_FULL_RELAY, /*inbound_onion=*/false);
6363
dummyNode1.SetCommonVersion(PROTOCOL_VERSION);
6464

6565
peerLogic->InitializeNode(&dummyNode1);
@@ -108,7 +108,7 @@ BOOST_AUTO_TEST_CASE(outbound_slow_chain_eviction)
108108
static void AddRandomOutboundPeer(std::vector<CNode*>& vNodes, PeerManager& peerLogic, ConnmanTestMsg& connman)
109109
{
110110
CAddress addr(ip(g_insecure_rand_ctx.randbits(32)), NODE_NONE);
111-
vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK | NODE_WITNESS), INVALID_SOCKET, addr, /* nKeyedNetGroupIn */ 0, /* nLocalHostNonceIn */ 0, CAddress(), /* pszDest */ "", ConnectionType::OUTBOUND_FULL_RELAY, /* inbound_onion */ false));
111+
vNodes.emplace_back(new CNode(id++, ServiceFlags(NODE_NETWORK | NODE_WITNESS), INVALID_SOCKET, addr, /*nKeyedNetGroupIn=*/0, /*nLocalHostNonceIn=*/0, CAddress(), /*addrNameIn=*/"", ConnectionType::OUTBOUND_FULL_RELAY, /*inbound_onion=*/false));
112112
CNode &node = *vNodes.back();
113113
node.SetCommonVersion(PROTOCOL_VERSION);
114114

@@ -212,9 +212,9 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
212212
std::array<CNode*, 3> nodes;
213213

214214
banman->ClearBanned();
215-
nodes[0] = new CNode{id++, NODE_NETWORK, INVALID_SOCKET, addr[0], /* nKeyedNetGroupIn */ 0,
216-
/* nLocalHostNonceIn */ 0, CAddress(), /* pszDest */ "",
217-
ConnectionType::INBOUND, /* inbound_onion */ false};
215+
nodes[0] = new CNode{id++, NODE_NETWORK, INVALID_SOCKET, addr[0], /*nKeyedNetGroupIn=*/0,
216+
/*nLocalHostNonceIn */ 0, CAddress(), /*addrNameIn=*/"",
217+
ConnectionType::INBOUND, /*inbound_onion=*/false};
218218
nodes[0]->SetCommonVersion(PROTOCOL_VERSION);
219219
peerLogic->InitializeNode(nodes[0]);
220220
nodes[0]->fSuccessfullyConnected = true;
@@ -228,9 +228,9 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
228228
BOOST_CHECK(nodes[0]->fDisconnect);
229229
BOOST_CHECK(!banman->IsDiscouraged(other_addr)); // Different address, not discouraged
230230

231-
nodes[1] = new CNode{id++, NODE_NETWORK, INVALID_SOCKET, addr[1], /* nKeyedNetGroupIn */ 1,
232-
/* nLocalHostNonceIn */ 1, CAddress(), /* pszDest */ "",
233-
ConnectionType::INBOUND, /* inbound_onion */ false};
231+
nodes[1] = new CNode{id++, NODE_NETWORK, INVALID_SOCKET, addr[1], /*nKeyedNetGroupIn=*/1,
232+
/*nLocalHostNonceIn */ 1, CAddress(), /*addrNameIn=*/"",
233+
ConnectionType::INBOUND, /*inbound_onion=*/false};
234234
nodes[1]->SetCommonVersion(PROTOCOL_VERSION);
235235
peerLogic->InitializeNode(nodes[1]);
236236
nodes[1]->fSuccessfullyConnected = true;
@@ -259,9 +259,9 @@ BOOST_AUTO_TEST_CASE(peer_discouragement)
259259

260260
// Make sure non-IP peers are discouraged and disconnected properly.
261261

262-
nodes[2] = new CNode{id++, NODE_NETWORK, INVALID_SOCKET, addr[2], /* nKeyedNetGroupIn */ 1,
263-
/* nLocalHostNonceIn */ 1, CAddress(), /* pszDest */ "",
264-
ConnectionType::OUTBOUND_FULL_RELAY, /* inbound_onion */ false};
262+
nodes[2] = new CNode{id++, NODE_NETWORK, INVALID_SOCKET, addr[2], /*nKeyedNetGroupIn=*/1,
263+
/*nLocalHostNonceIn */ 1, CAddress(), /*addrNameIn=*/"",
264+
ConnectionType::OUTBOUND_FULL_RELAY, /*inbound_onion=*/false};
265265
nodes[2]->SetCommonVersion(PROTOCOL_VERSION);
266266
peerLogic->InitializeNode(nodes[2]);
267267
nodes[2]->fSuccessfullyConnected = true;
@@ -297,7 +297,7 @@ BOOST_AUTO_TEST_CASE(DoS_bantime)
297297
SetMockTime(nStartTime); // Overrides future calls to GetTime()
298298

299299
CAddress addr(ip(0xa0b0c001), NODE_NONE);
300-
CNode dummyNode(id++, NODE_NETWORK, INVALID_SOCKET, addr, /* nKeyedNetGroupIn */ 4, /* nLocalHostNonceIn */ 4, CAddress(), /* pszDest */ "", ConnectionType::INBOUND, /* inbound_onion */ false);
300+
CNode dummyNode(id++, NODE_NETWORK, INVALID_SOCKET, addr, /*nKeyedNetGroupIn=*/4, /*nLocalHostNonceIn=*/4, CAddress(), /*addrNameIn=*/"", ConnectionType::INBOUND, /*inbound_onion=*/false);
301301
dummyNode.SetCommonVersion(PROTOCOL_VERSION);
302302
peerLogic->InitializeNode(&dummyNode);
303303
dummyNode.fSuccessfullyConnected = true;

src/test/fuzz/tx_pool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ void Finish(FuzzedDataProvider& fuzzed_data_provider, MockedTxPool& tx_pool, CCh
9393
const auto info_all = tx_pool.infoAll();
9494
if (!info_all.empty()) {
9595
const auto& tx_to_remove = *PickValue(fuzzed_data_provider, info_all).tx;
96-
WITH_LOCK(tx_pool.cs, tx_pool.removeRecursive(tx_to_remove, /* dummy */ MemPoolRemovalReason::BLOCK));
96+
WITH_LOCK(tx_pool.cs, tx_pool.removeRecursive(tx_to_remove, MemPoolRemovalReason::BLOCK /* dummy */));
9797
std::vector<uint256> all_txids;
9898
tx_pool.queryHashes(all_txids);
9999
assert(all_txids.size() < info_all.size());

src/test/txpackage_tests.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,19 @@ BOOST_FIXTURE_TEST_CASE(package_validation_tests, TestChain100Setup)
7373
CKey parent_key;
7474
parent_key.MakeNewKey(true);
7575
CScript parent_locking_script = GetScriptForDestination(PKHash(parent_key.GetPubKey()));
76-
auto mtx_parent = CreateValidMempoolTransaction(/* input_transaction */ m_coinbase_txns[0], /* vout */ 0,
77-
/* input_height */ 0, /* input_signing_key */ coinbaseKey,
78-
/* output_destination */ parent_locking_script,
79-
/* output_amount */ CAmount(49 * COIN), /* submit */ false);
76+
auto mtx_parent = CreateValidMempoolTransaction(/*input_transaction=*/ m_coinbase_txns[0], /*input_vout=*/0,
77+
/*input_height=*/ 0, /*input_signing_key=*/coinbaseKey,
78+
/*output_destination=*/ parent_locking_script,
79+
/*output_amount=*/ CAmount(49 * COIN), /*submit=*/false);
8080
CTransactionRef tx_parent = MakeTransactionRef(mtx_parent);
8181

8282
CKey child_key;
8383
child_key.MakeNewKey(true);
8484
CScript child_locking_script = GetScriptForDestination(PKHash(child_key.GetPubKey()));
85-
auto mtx_child = CreateValidMempoolTransaction(/* input_transaction */ tx_parent, /* vout */ 0,
86-
/* input_height */ 101, /* input_signing_key */ parent_key,
87-
/* output_destination */ child_locking_script,
88-
/* output_amount */ CAmount(48 * COIN), /* submit */ false);
85+
auto mtx_child = CreateValidMempoolTransaction(/*input_transaction=*/ tx_parent, /*input_vout=*/0,
86+
/*input_height=*/ 101, /*input_signing_key=*/parent_key,
87+
/*output_destination */ child_locking_script,
88+
/*output_amount=*/ CAmount(48 * COIN), /*submit=*/false);
8989
CTransactionRef tx_child = MakeTransactionRef(mtx_child);
9090
const auto result_parent_child = ProcessNewPackage(m_node.chainman->ActiveChainstate(), *m_node.mempool, {tx_parent, tx_child}, /* test_accept */ true);
9191
BOOST_CHECK_MESSAGE(result_parent_child.m_state.IsValid(),

src/test/validation_block_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(mempool_locks_reorg)
222222
{
223223
bool ignored;
224224
auto ProcessBlock = [&](std::shared_ptr<const CBlock> block) -> bool {
225-
return Assert(m_node.chainman)->ProcessNewBlock(Params(), block, /* fForceProcessing */ true, /* fNewBlock */ &ignored);
225+
return Assert(m_node.chainman)->ProcessNewBlock(Params(), block, /*force_processing=*/true, /*new_block=*/&ignored);
226226
};
227227

228228
// Process all mined blocks

0 commit comments

Comments
 (0)