From a701a8d5c96a907355f87f2e8716530a94c8474d Mon Sep 17 00:00:00 2001 From: pasta Date: Mon, 4 Mar 2024 00:38:41 -0600 Subject: [PATCH] refactor: actually move out of previousQuarters.quarterHMinus*C and newQuarterMembers into quorumMembers --- src/llmq/utils.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/llmq/utils.cpp b/src/llmq/utils.cpp index 1da1dadf0c..7b99884701 100644 --- a/src/llmq/utils.cpp +++ b/src/llmq/utils.cpp @@ -243,18 +243,11 @@ std::vector> ComputeQuorumMembersByQuarterRota } for (const size_t i : irange::range(nQuorums)) { - for (const auto &m: previousQuarters.quarterHMinus3C[i]) { - quorumMembers[i].push_back(std::move(m)); - } - for (const auto &m: previousQuarters.quarterHMinus2C[i]) { - quorumMembers[i].push_back(std::move(m)); - } - for (const auto &m: previousQuarters.quarterHMinusC[i]) { - quorumMembers[i].push_back(std::move(m)); - } - for (const auto &m: newQuarterMembers[i]) { - quorumMembers[i].push_back(std::move(m)); - } + // Move elements from previous quarters into quorumMembers + std::move(previousQuarters.quarterHMinus3C[i].begin(), previousQuarters.quarterHMinus3C[i].end(), std::back_inserter(quorumMembers[i])); + std::move(previousQuarters.quarterHMinus2C[i].begin(), previousQuarters.quarterHMinus2C[i].end(), std::back_inserter(quorumMembers[i])); + std::move(previousQuarters.quarterHMinusC[i].begin(), previousQuarters.quarterHMinusC[i].end(), std::back_inserter(quorumMembers[i])); + std::move(newQuarterMembers[i].begin(), newQuarterMembers[i].end(), std::back_inserter(quorumMembers[i])); if (LogAcceptCategory(BCLog::LLMQ)) { std::stringstream ss;