bench: Remove unnecessary wallet parameter
What changed, and why it matters
This is a minor code cleanup in a benchmark test file. It removes an unused wallet parameter from a helper function used only for performance testing of coin selection. The change does not affect live wallet behavior, network consensus, or user funds.
No security action needed. Treat as normal code-quality review.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies src/bench/coin_selection.cpp, a benchmark file. The static helper addCoin no longer takes a const CWallet& wallet parameter because it was not used inside the function. Call sites are updated accordingly. In the coin construction loop, CalculateMaximumSignedInputSize(txout, &wallet, nullptr) is replaced with a literal -1 for input_bytes. This is acceptable in a benchmark context because the benchmark is measuring coin-selection algorithm performance, not signature-size estimation accuracy. The change is purely refactoring/cleanup.
Changed components
src/bench/coin_selection.cppInspect captured patch +4 / −4
diff --git a/src/bench/coin_selection.cpp b/src/bench/coin_selection.cpp
index 28a8ca8e..82f1359e 100644
--- a/src/bench/coin_selection.cpp
+++ b/src/bench/coin_selection.cpp
@@ -29,7 +29,7 @@
#include <vector>
namespace wallet {
-static void addCoin(const CAmount& nValue, const CWallet& wallet, std::vector<std::unique_ptr<CWalletTx>>& wtxs)
+static void addCoin(const CAmount& nValue, std::vector<std::unique_ptr<CWalletTx>>& wtxs)
{
static int nextLockTime = 0;
CMutableTransaction tx;
@@ -55,15 +55,15 @@ static void CoinSelection(benchmark::Bench& bench)
// Add coins.
for (int i = 0; i < 1000; ++i) {
- addCoin(1000 * COIN, wallet, wtxs);
+ addCoin(1000 * COIN, wtxs);
}
- addCoin(3 * COIN, wallet, wtxs);
+ addCoin(3 * COIN, wtxs);
// Create coins
wallet::CoinsResult available_coins;
for (const auto& wtx : wtxs) {
const auto txout = wtx->tx->vout.at(0);
- available_coins.coins[OutputType::BECH32].emplace_back(COutPoint(wtx->GetHash(), 0), txout, /*depth=*/6 * 24, CalculateMaximumSignedInputSize(txout, &wallet, /*coin_control=*/nullptr), /*solvable=*/true, /*safe=*/true, wtx->GetTxTime(), /*from_me=*/true, /*fees=*/ 0);
+ available_coins.coins[OutputType::BECH32].emplace_back(COutPoint(wtx->GetHash(), 0), txout, /*depth=*/6 * 24, /*input_bytes=*/-1, /*solvable=*/true, /*safe=*/true, wtx->GetTxTime(), /*from_me=*/true, /*fees=*/0);
}
const CoinEligibilityFilter filter_standard(1, 6, 0);
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.