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

Function json_splice_update

lightningd/channel_control.c:2488–2534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2486}
2487
2488static struct command_result *json_splice_update(struct command *cmd,
2489 const char *buffer,
2490 const jsmntok_t *obj UNNEEDED,
2491 const jsmntok_t *params)
2492{
2493 struct channel *channel;
2494 struct splice_command *cc;
2495 struct wally_psbt *psbt;
2496
2497 if (!param(cmd, buffer, params,
2498 p_req("channel_id", param_channel_for_splice, &channel),
2499 p_req("psbt", param_psbt, &psbt),
2500 NULL))
2501 return command_param_failed();
2502
2503 if (splice_command_for_chan(cmd->ld, channel))
2504 return command_fail(cmd,
2505 SPLICE_BUSY_ERROR,
2506 "Currently waiting on previous splice"
2507 " command to finish.");
2508 if (!validate_psbt(psbt))
2509 return command_fail(cmd,
2510 SPLICE_INPUT_ERROR,
2511 "PSBT failed to validate.");
2512
2513 log_debug(cmd->ld->log, "splice_update input PSBT version %d",
2514 psbt->version);
2515
2516 cc = tal(cmd, struct splice_command);
2517
2518 list_add_tail(&cmd->ld->splice_commands, &cc->list);
2519 tal_add_destructor(cc, destroy_splice_command);
2520
2521 cc->cmd = cmd;
2522 cc->channel = channel;
2523 cc->stfu_req_info = NULL;
2524 cc->user_psbt_ver = psbt->version;
2525
2526 if (psbt->version != 2 && !psbt_set_version(psbt, 2))
2527 return command_fail(cmd,
2528 SPLICE_INPUT_ERROR,
2529 "Splice failed to convert to v2");
2530
2531 subd_send_msg(channel->owner,
2532 take(towire_channeld_splice_update(NULL, psbt)));
2533 return command_still_pending(cmd);
2534}
2535
2536static struct command_result *single_splice_signed(struct command *cmd,
2537 struct channel *channel,

Callers

nothing calls this directly

Calls 8

splice_command_for_chanFunction · 0.85
validate_psbtFunction · 0.85
psbt_set_versionFunction · 0.85
command_param_failedFunction · 0.70
command_failFunction · 0.70
subd_send_msgFunction · 0.70
command_still_pendingFunction · 0.70
paramFunction · 0.50

Tested by

no test coverage detected