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

Function handle_splice_confirmed_init

lightningd/channel_control.c:402–435  ·  view source on GitHub ↗

When channeld finishes processing the `splice_init` command, this is called */

Source from the content-addressed store, hash-verified

400
401/* When channeld finishes processing the `splice_init` command, this is called */
402static void handle_splice_confirmed_init(struct lightningd *ld,
403 struct channel *channel,
404 const u8 *msg)
405{
406 struct splice_command *cc;
407 struct wally_psbt *psbt;
408
409 if (!fromwire_channeld_splice_confirmed_init(tmpctx, msg, &psbt)) {
410 channel_internal_error(channel,
411 "bad splice_confirmed_init %s",
412 tal_hex(channel, msg));
413 return;
414 }
415
416 cc = splice_command_for_chan(ld, channel);
417 if (!cc) {
418 channel_internal_error(channel, "splice_confirmed_init"
419 " received without an active command %s",
420 tal_hex(channel, msg));
421 return;
422 }
423
424 if (psbt->version != cc->user_psbt_ver
425 && !psbt_set_version(psbt, cc->user_psbt_ver))
426 channel_internal_error(channel, "Splice failed to convert from"
427 " internal version "PRIu32" to user"
428 " version "PRIu32, psbt->version,
429 cc->user_psbt_ver);
430
431 struct json_stream *response = json_stream_success(cc->cmd);
432 json_add_string(response, "psbt", fmt_wally_psbt(tmpctx, psbt));
433
434 was_pending(command_success(cc->cmd, response));
435}
436
437/* Channeld sends us this in response to a user's `splice_update` request */
438static void handle_splice_confirmed_update(struct lightningd *ld,

Callers 1

channel_msgFunction · 0.85

Calls 9

tal_hexFunction · 0.85
splice_command_for_chanFunction · 0.85
psbt_set_versionFunction · 0.85
fmt_wally_psbtFunction · 0.85
channel_internal_errorFunction · 0.70
json_stream_successFunction · 0.70
was_pendingFunction · 0.70
command_successFunction · 0.70
json_add_stringFunction · 0.50

Tested by

no test coverage detected