From 3a1743fc7fe66c82a07f5c8643b68e1aa520a9f9 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Fri, 13 Sep 2024 13:40:26 +0000 Subject: [PATCH] trivial: avoid unneeded copy when iterating through `mapDenomCount` Caught by Clang 14 with `--enable-werror` --- src/coinjoin/client.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coinjoin/client.cpp b/src/coinjoin/client.cpp index bf8e25ab0b..86dce7a10b 100644 --- a/src/coinjoin/client.cpp +++ b/src/coinjoin/client.cpp @@ -1727,7 +1727,7 @@ bool CCoinJoinClientSession::CreateDenominated(CAmount nBalanceToDenominate, con } bool finished = true; - for (const auto [denom, count] : mapDenomCount) { + for (const auto& [denom, count] : mapDenomCount) { // Check if this specific denom could use another loop, check that there aren't nCoinJoinDenomsGoal of this // denom and that our nValueLeft/nBalanceToDenominate is enough to create one of these denoms, if so, loop again. if (count < CCoinJoinClientOptions::GetDenomsGoal() && txBuilder.CouldAddOutput(denom) && nBalanceToDenominate > 0) { @@ -1807,7 +1807,7 @@ bool CCoinJoinClientSession::CreateDenominated(CAmount nBalanceToDenominate, con WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- 3 - nBalanceToDenominate: %f, %s\n", __func__, (float) nBalanceToDenominate / COIN, txBuilder.ToString()); - for (const auto [denom, count] : mapDenomCount) { + for (const auto& [denom, count] : mapDenomCount) { WalletCJLogPrint(m_wallet, "CCoinJoinClientSession::%s -- 3 - DONE - nDenomValue: %f, count: %d\n", __func__, (float) denom / COIN, count); }