Merge bitcoin/bitcoin#30253: refactor: performance-for-range-copy in psbt.h

fab01b5220 refactor: performance-for-range-copy in psbt.h (MarcoFalke)

Pull request description:

  A copy of the partial signatures is not required before serializing them.

  For reference, this was found by switching the codebase to `std::span` (not sure why it wasn't found with `Span` though):

  ```
  ./psbt.h:240:23: error: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy,-warnings-as-errors]
    240 |             for (auto sig_pair : partial_sigs) {
        |                       ^
        |                  const  &

ACKs for top commit:
  tdb3:
    ACK fab01b5220
  theStack:
    utACK fab01b5220

Tree-SHA512: b55513d8191118499716684190ee568d171b50ae9171d246ca6e047f0cfd3ec14c9453d721e88af55e47bb41fa66cbafdbfb47bc5f9b8d82789e0a9b634b371b
This commit is contained in:
merge-script 2024-06-10 09:21:19 +01:00
commit ea88a7596e
No known key found for this signature in database
GPG Key ID: 2EEB9F5CC09526C1

View File

@ -237,7 +237,7 @@ struct PSBTInput
if (final_script_sig.empty() && final_script_witness.IsNull()) {
// Write any partial signatures
for (auto sig_pair : partial_sigs) {
for (const auto& sig_pair : partial_sigs) {
SerializeToVector(s, CompactSizeWriter(PSBT_IN_PARTIAL_SIG), Span{sig_pair.second.first});
s << sig_pair.second.second;
}