Merge bitcoin/bitcoin#22342: Avoid the use of P0083R3 std::set::merge

6cf4ea7187 Avoid the use of P0083R3 std::set::merge (Pieter Wuille)

Pull request description:

  This use was introduced in #21365, but as pointed out in #22339, this causes compatibility problems.

  Just avoid its use for now.

ACKs for top commit:
  jonatack:
    re-ACK 6cf4ea7187
  benthecarman:
    ACK 6cf4ea7187
  hebasto:
    ACK 6cf4ea7187, successfully compiled on the following systems:

Tree-SHA512: 2b3fdcadb7de98963ebb0b192bd956aa68526457fe5b374c74a69ea10d5b68902763148f11abbcc471010bcdc799e0804faef5f8e8ff8a509b3a053c0cb0ba39
This commit is contained in:
MarcoFalke 2021-06-26 10:02:31 +02:00
commit 9c3751a0c9
No known key found for this signature in database
GPG key ID: CE2B75697E69A548

View file

@ -407,7 +407,13 @@ void TaprootSpendData::Merge(TaprootSpendData other)
merkle_root = other.merkle_root;
}
for (auto& [key, control_blocks] : other.scripts) {
scripts[key].merge(std::move(control_blocks));
// Once P0083R3 is supported by all our targeted platforms,
// this loop body can be replaced with:
// scripts[key].merge(std::move(control_blocks));
auto& target = scripts[key];
for (auto& control_block: control_blocks) {
target.insert(std::move(control_block));
}
}
}