| 469 | } |
| 470 | |
| 471 | static struct command_result * |
| 472 | collect_sigs(struct multifundchannel_command *mfc) |
| 473 | { |
| 474 | /* There's a very small chance that we'll get a |
| 475 | * race condition between when a signature arrives |
| 476 | * and all of the fundchannel_completes return. |
| 477 | * This flag helps us avoid invoking this twice.*/ |
| 478 | if (mfc->sigs_collected) |
| 479 | return NULL; |
| 480 | |
| 481 | mfc->sigs_collected = true; |
| 482 | /* But first! we sanity check that everyone's |
| 483 | * expecting the same funding txid */ |
| 484 | for (size_t i = 0; i < tal_count(mfc->destinations); i++) { |
| 485 | struct multifundchannel_destination *dest; |
| 486 | struct bitcoin_txid dest_txid; |
| 487 | dest = &mfc->destinations[i]; |
| 488 | |
| 489 | if (!is_v2(dest)) { |
| 490 | /* Since we're here, double check that |
| 491 | * every v1 has their commitment txs */ |
| 492 | assert(dest->state == MULTIFUNDCHANNEL_COMPLETED); |
| 493 | continue; |
| 494 | } |
| 495 | |
| 496 | assert(dest->state == MULTIFUNDCHANNEL_SIGNED); |
| 497 | psbt_txid(NULL, dest->psbt, &dest_txid, NULL); |
| 498 | |
| 499 | assert(bitcoin_txid_eq(mfc->txid, &dest_txid)); |
| 500 | } |
| 501 | |
| 502 | return perform_signpsbt(mfc); |
| 503 | } |
| 504 | |
| 505 | struct command_result * |
| 506 | check_sigs_ready(struct multifundchannel_command *mfc) |
no test coverage detected