| 390 | } |
| 391 | |
| 392 | void TaprootSpendData::Merge(TaprootSpendData other) |
| 393 | { |
| 394 | // TODO: figure out how to better deal with conflicting information |
| 395 | // being merged. |
| 396 | if (internal_key.IsNull() && !other.internal_key.IsNull()) { |
| 397 | internal_key = other.internal_key; |
| 398 | } |
| 399 | if (merkle_root.IsNull() && !other.merkle_root.IsNull()) { |
| 400 | merkle_root = other.merkle_root; |
| 401 | } |
| 402 | for (auto& [key, control_blocks] : other.scripts) { |
| 403 | // Once P0083R3 is supported by all our targeted platforms, |
| 404 | // this loop body can be replaced with: |
| 405 | // scripts[key].merge(std::move(control_blocks)); |
| 406 | auto& target = scripts[key]; |
| 407 | for (auto& control_block: control_blocks) { |
| 408 | target.insert(std::move(control_block)); |
| 409 | } |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | void TaprootBuilder::Insert(TaprootBuilder::NodeInfo&& node, int depth) |
| 414 | { |