| 2386 | } |
| 2387 | |
| 2388 | static 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 | |
| 2436 | static struct command_result *single_splice_signed(struct command *cmd, |
| 2437 | struct channel *channel, |
nothing calls this directly
no test coverage detected