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

Function mw_after_signpsbt

plugins/spender/multiwithdraw.c:645–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

643}
644
645static struct command_result *
646mw_after_signpsbt(struct command *cmd,
647 const char *buf,
648 const jsmntok_t *result,
649 struct multiwithdraw_command *mw)
650{
651 const jsmntok_t *signed_psbttok;
652 struct wally_psbt *psbt;
653 bool ok = true;
654 struct out_req *req;
655
656 signed_psbttok = ok ? json_get_member(buf, result, "signed_psbt") : NULL;
657 ok = ok && signed_psbttok;
658 psbt = ok ? psbt_from_b64(mw,
659 buf + signed_psbttok->start,
660 signed_psbttok->end - signed_psbttok->start) : NULL;
661 ok = ok && psbt;
662
663 if (!ok)
664 plugin_err(mw->cmd->plugin,
665 "Unexpected result from signpsbt: %.*s",
666 json_tok_full_len(result),
667 json_tok_full(buf, result));
668
669 /* Substitute the PSBT. */
670 tal_free(mw->psbt);
671 mw->psbt = psbt;
672
673 /* Perform sendpsbt. */
674 plugin_log(mw->cmd->plugin, LOG_DBG,
675 "multiwithdraw: %"PRIu64": sendpsbt.", mw->id);
676
677 req = jsonrpc_request_start(mw->cmd->plugin,
678 mw->cmd,
679 "sendpsbt",
680 &forward_result,
681 /* Properly speaking, if `sendpsbt` fails,
682 * we should assume an edge case where the
683 * the transaction was sent to *some*
684 * mempool (from where it *could* get
685 * propagated to miners), but confirmation
686 * that it got into *some* mempool was not
687 * received.
688 */
689 &mw_forward_error,
690 mw);
691 json_add_psbt(req->js, "psbt", mw->psbt);
692 return send_outreq(mw->cmd->plugin, req);
693}

Callers

nothing calls this directly

Calls 9

psbt_from_b64Function · 0.85
tal_freeFunction · 0.85
json_add_psbtFunction · 0.85
json_get_memberFunction · 0.50
plugin_errFunction · 0.50
json_tok_full_lenFunction · 0.50
json_tok_fullFunction · 0.50
plugin_logFunction · 0.50
send_outreqFunction · 0.50

Tested by

no test coverage detected