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

Function json_splice_update

lightningd/channel_control.c:2388–2434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2386}
2387
2388static struct command_result *json_splice_update(struct command *cmd,
2389 const char *buffer,
2390 const jsmntok_t *obj UNNEEDED,
2391 const jsmntok_t *params)
2392{
2393 struct channel *channel;
2394 struct splice_command *cc;
2395 struct wally_psbt *psbt;
2396
2397 if (!param(cmd, buffer, params,
2398 p_req("channel_id", param_channel_for_splice, &channel),
2399 p_req("psbt", param_psbt, &psbt),
2400 NULL))
2401 return command_param_failed();
2402
2403 if (splice_command_for_chan(cmd->ld, channel))
2404 return command_fail(cmd,
2405 SPLICE_BUSY_ERROR,
2406 "Currently waiting on previous splice"
2407 " command to finish.");
2408 if (!validate_psbt(psbt))
2409 return command_fail(cmd,
2410 SPLICE_INPUT_ERROR,
2411 "PSBT failed to validate.");
2412
2413 log_debug(cmd->ld->log, "splice_update input PSBT version %d",
2414 psbt->version);
2415
2416 cc = tal(cmd, struct splice_command);
2417
2418 list_add_tail(&cmd->ld->splice_commands, &cc->list);
2419 tal_add_destructor(cc, destroy_splice_command);
2420
2421 cc->cmd = cmd;
2422 cc->channel = channel;
2423 cc->stfu_req_info = NULL;
2424 cc->user_psbt_ver = psbt->version;
2425
2426 if (psbt->version != 2 && !psbt_set_version(psbt, 2))
2427 return command_fail(cmd,
2428 SPLICE_INPUT_ERROR,
2429 "Splice failed to convert to v2");
2430
2431 subd_send_msg(channel->owner,
2432 take(towire_channeld_splice_update(NULL, psbt)));
2433 return command_still_pending(cmd);
2434}
2435
2436static struct command_result *single_splice_signed(struct command *cmd,
2437 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