| 2434 | } |
| 2435 | |
| 2436 | static struct command_result *single_splice_signed(struct command *cmd, |
| 2437 | struct channel *channel, |
| 2438 | struct wally_psbt *psbt, |
| 2439 | bool sign_first, |
| 2440 | bool *success) |
| 2441 | { |
| 2442 | struct splice_command *cc; |
| 2443 | u8 *msg; |
| 2444 | |
| 2445 | if (splice_command_for_chan(cmd->ld, channel)) |
| 2446 | return command_fail(cmd, |
| 2447 | SPLICE_BUSY_ERROR, |
| 2448 | "Currently waiting on previous splice" |
| 2449 | " command to finish."); |
| 2450 | |
| 2451 | cc = tal(cmd, struct splice_command); |
| 2452 | |
| 2453 | list_add_tail(&cmd->ld->splice_commands, &cc->list); |
| 2454 | tal_add_destructor(cc, destroy_splice_command); |
| 2455 | |
| 2456 | cc->cmd = cmd; |
| 2457 | cc->channel = channel; |
| 2458 | cc->stfu_req_info = NULL; |
| 2459 | cc->user_psbt_ver = psbt->version; |
| 2460 | |
| 2461 | if (psbt->version != 2 && !psbt_set_version(psbt, 2)) |
| 2462 | return command_fail(cmd, |
| 2463 | SPLICE_INPUT_ERROR, |
| 2464 | "Splice failed to convert to v2"); |
| 2465 | |
| 2466 | /* Update "funding" psbt now */ |
| 2467 | tal_free(channel->funding_psbt); |
| 2468 | channel->funding_psbt = clone_psbt(channel, psbt); |
| 2469 | wallet_channel_save(cmd->ld->wallet, channel); |
| 2470 | |
| 2471 | msg = towire_channeld_splice_signed(tmpctx, psbt, sign_first); |
| 2472 | subd_send_msg(channel->owner, take(msg)); |
| 2473 | if (success) |
| 2474 | *success = true; |
| 2475 | return command_still_pending(cmd); |
| 2476 | } |
| 2477 | |
| 2478 | static struct command_result *json_splice_signed(struct command *cmd, |
| 2479 | const char *buffer, |
no test coverage detected