txgraph: avoid moving primitive members
What changed, and why it matters
This is a tiny code-cleanup change in Bitcoin Core's internal transaction graph logic. It swaps three std::move calls for plain assignments because the variables are simple numbers or booleans, where moving and copying do the exact same thing. There is no security impact.
No security action needed. Treat as normal code-quality maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
In TxGraphImpl::CommitStaging(), the patch replaces std::move on three primitive staging members (m_oversized, m_txcount, m_txcount_oversized) with direct copy assignment. For non-class types such as bool and size_t, std::move is semantically equivalent to a copy and may generate a compiler warning or be misleading to readers. The owning containers above are still correctly moved. This is a non-functional style/refactor fix.
Changed components
src/txgraph.cppTxGraphImpl::CommitStaging()Inspect captured patch +3 / −3
diff --git a/src/txgraph.cpp b/src/txgraph.cpp
index 39a8a881..c7d49003 100644
--- a/src/txgraph.cpp
+++ b/src/txgraph.cpp
@@ -2710,9 +2710,9 @@ void TxGraphImpl::CommitStaging() noexcept
m_main_clusterset.m_deps_to_add = std::move(m_staging_clusterset->m_deps_to_add);
m_main_clusterset.m_to_remove = std::move(m_staging_clusterset->m_to_remove);
m_main_clusterset.m_group_data = std::move(m_staging_clusterset->m_group_data);
- m_main_clusterset.m_oversized = std::move(m_staging_clusterset->m_oversized);
- m_main_clusterset.m_txcount = std::move(m_staging_clusterset->m_txcount);
- m_main_clusterset.m_txcount_oversized = std::move(m_staging_clusterset->m_txcount_oversized);
+ m_main_clusterset.m_oversized = m_staging_clusterset->m_oversized;
+ m_main_clusterset.m_txcount = m_staging_clusterset->m_txcount;
+ m_main_clusterset.m_txcount_oversized = m_staging_clusterset->m_txcount_oversized;
// Delete the old staging graph, after all its information was moved to main.
m_staging_clusterset.reset();
Compact();
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.