MCPcopy Create free account
hub / github.com/ElementsProject/lightning / collect_sigs

Function collect_sigs

plugins/spender/openchannel.c:483–515  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

check_sigs_readyFunction · 0.85

Calls 3

is_v2Function · 0.85
psbt_txidFunction · 0.85
perform_signpsbtFunction · 0.85

Tested by

no test coverage detected