Files
bitcoin/src/test/coins_tests.cpp
Hennadii Stepanov 9d6ba4b3b5 Merge bitcoin/bitcoin#34514: refactor: remove unnecessary std::move for a few trivially copyable types
3e8e21b2ef txgraph: avoid moving primitive members (Lőrinc)
d9f94aa882 rpc: avoid moving RPC enum types (Lőrinc)
b67baed4e7 coins: avoid moving `COutPoint` values (Lőrinc)

Pull request description:

  Inspired by https://github.com/bitcoin/bitcoin/pull/34320#discussion_r2751764873.

  **Problem:** A few code paths use rvalue references or `std::move()` for types where moving provides no benefit.

  `EmplaceCoinInternalDANGER` took `COutPoint&&`, forcing callers to pass trivially copyable outpoints as rvalues even though the cache stores its own key.

  Some call sites also use `std::move()` on enum and primitive values, where it only adds noise.
  > [!NOTE]
  > `CheckTriviallyCopyableMove` remains `false` since `std::move()` on trivially copyable types can still be useful as intent documentation, for example to signal that a value should not be reused after a call.

  **Fix:** Take trivially copyable arguments by const reference where the callee only needs to store its own copy, and pass existing values directly at the call sites.

  Also remove `std::move()` from enum and primitive assignments where it has no semantic effect.

ACKs for top commit:
  maflcko:
    review ACK 3e8e21b2ef 🖇
  hodlinator:
    re-ACK 3e8e21b2ef
  andrewtoth:
    ACK 3e8e21b2ef
  hebasto:
    ACK 3e8e21b2ef, I have reviewed the code and it looks OK.

Tree-SHA512: cbe55b13290ae261bba359dc6e5a3bbdfb7ae9d31bdf8e0da2eef65a0df776e4081ceeac3c82731a631bda656a86b3789651fa1f4d87875cee1dc96351bdfd7c
2026-07-17 11:36:46 +01:00

50 KiB