Merge bitcoin/bitcoin#35914: test, fuzz: Remove unused variables
What changed, and why it matters
This commit removes unused variables from Bitcoin Core's test and fuzzing code. It is a cleanup/refactoring change with no effect on the live network software or user funds. It does not fix or introduce any security vulnerability.
No security action required. Treat as normal code-quality/test maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The merge commit removes 13 lines of dead/unused variable declarations across eight test/fuzz source files (cluster_linearize, locale, p2p_transport_serialization, rbf_tests, txgraph_tests, coinselector_tests, wallet/test/util.cpp, wallet_tests). The changes are purely compile-time hygiene, likely triggered by a new compiler warning (LLVM clang change referenced in the PR description). None of the removed variables are used in control flow, memory management, or security-relevant logic.
Changed components
src/test/fuzz/cluster_linearize.cppsrc/test/fuzz/locale.cppsrc/test/fuzz/p2p_transport_serialization.cppsrc/test/rbf_tests.cppsrc/test/txgraph_tests.cppsrc/wallet/test/coinselector_tests.cppsrc/wallet/test/util.cppsrc/wallet/test/wallet_tests.cppInspect captured patch +1 / −13
### src/test/fuzz/cluster_linearize.cpp
@@ -611,7 +611,6 @@ FUZZ_TARGET(clusterlin_components)
// Construct a depgraph.
SpanReader reader(buffer);
DepGraph<TestBitSet> depgraph;
- std::vector<DepGraphIndex> linearization;
try {
reader >> Using<DepGraphFormatter>(depgraph);
} catch (const std::ios_base::failure&) {}
### src/test/fuzz/locale.cpp
@@ -45,7 +45,6 @@ FUZZ_TARGET(locale)
const char* c_locale = std::setlocale(LC_ALL, "C");
assert(c_locale != nullptr);
- const std::string random_string = fuzzed_data_provider.ConsumeRandomLengthString(5);
const int64_t random_int64 = fuzzed_data_provider.ConsumeIntegral<int64_t>();
const std::string tostring_without_locale = util::ToString(random_int64);
const std::string strprintf_int_without_locale = strprintf("%d", random_int64);
### src/test/fuzz/p2p_transport_serialization.cpp
@@ -86,7 +86,6 @@ FUZZ_TARGET(p2p_transport_serialization, .init = initialize_p2p_transport_serial
assert(msg.m_raw_message_size == CMessageHeader::HEADER_SIZE + msg.m_message_size);
assert(msg.m_time == time);
- std::vector<unsigned char> header;
auto msg2 = NetMsg::Make(msg.m_type, std::span{msg.m_recv});
bool queued = send_transport.SetMessageToSend(msg2);
assert(queued);
### src/test/rbf_tests.cpp
@@ -121,11 +121,6 @@ BOOST_FIXTURE_TEST_CASE(rbf_helper_functions, TestChain100Setup)
BOOST_CHECK_EQUAL(entry8_high->GetFee(), high_fee);
CTxMemPool::setEntries set_12_normal{entry1_normal, entry2_normal};
- CTxMemPool::setEntries set_34_cpfp{entry3_low, entry4_high};
- CTxMemPool::setEntries set_56_low{entry5_low, entry6_low_prioritised};
- CTxMemPool::setEntries set_78_high{entry7_high, entry8_high};
- CTxMemPool::setEntries all_entries{entry1_normal, entry2_normal, entry3_low, entry4_high,
- entry5_low, entry6_low_prioritised, entry7_high, entry8_high};
CTxMemPool::setEntries empty_set;
const auto unused_txid = Txid::FromUint256(GetRandHash());
### src/test/txgraph_tests.cpp
@@ -290,7 +290,7 @@ BOOST_AUTO_TEST_CASE(txgraph_trim_big_singletons)
BOOST_CHECK(graph->IsOversized(TxGraph::Level::TOP));
// Call Trim() to remove transactions and bring the cluster back within limits.
- auto removed_refs = graph->Trim();
+ graph->Trim();
graph->SanityCheck();
BOOST_CHECK_EQUAL(graph->GetTransactionCount(TxGraph::Level::TOP), NUM_TOTAL_TX - 6);
BOOST_CHECK(!graph->IsOversized(TxGraph::Level::TOP));
### src/wallet/test/coinselector_tests.cpp
@@ -169,7 +169,6 @@ BOOST_AUTO_TEST_CASE(bnb_search_test)
{
FastRandomContext rand{};
// Setup
- std::vector<COutput> utxo_pool;
SelectionResult expected_result(CAmount(0), SelectionAlgorithm::BNB);
size_t expected_attempts;
### src/wallet/test/util.cpp
@@ -67,7 +67,6 @@ std::shared_ptr<CWallet> TestCreateWallet(WalletContext& context)
options.create_flags = WALLET_FLAG_DESCRIPTORS;
DatabaseStatus status;
bilingual_str error;
- std::vector<bilingual_str> warnings;
auto database = MakeWalletDatabase("", options, status, error);
return TestCreateWallet(std::move(database), context, options.create_flags);
}
@@ -91,7 +90,6 @@ std::shared_ptr<CWallet> TestLoadWallet(WalletContext& context)
options.require_existing = true;
DatabaseStatus status;
bilingual_str error;
- std::vector<bilingual_str> warnings;
auto database = MakeWalletDatabase("", options, status, error);
return TestLoadWallet(std::move(database), context);
}
### src/wallet/test/wallet_tests.cpp
@@ -728,7 +728,6 @@ BOOST_FIXTURE_TEST_CASE(RemoveTxs, TestChain100Setup)
CKey key = GenerateRandomKey();
AddKey(*wallet, key);
- std::string error;
m_coinbase_txns.push_back(CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey())).vtx[0]);
auto block_tx = TestSimpleSpend(*m_coinbase_txns[0], 0, coinbaseKey, GetScriptForRawPubKey(key.GetPubKey()));
CreateAndProcessBlock({block_tx}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.