| 979 | } |
| 980 | |
| 981 | static struct command_result *splice_init(struct command *cmd, |
| 982 | struct splice_cmd *splice_cmd, |
| 983 | size_t index) |
| 984 | { |
| 985 | struct splice_script_result *action = splice_cmd->actions[index]; |
| 986 | struct splice_cmd_action_state *state = splice_cmd->states[index]; |
| 987 | struct out_req *req; |
| 988 | |
| 989 | req = jsonrpc_request_start(cmd, "splice_init", |
| 990 | splice_init_get_result, splice_error, |
| 991 | splice_cmd); |
| 992 | |
| 993 | json_add_channel_id(req->js, "channel_id", action->channel_id); |
| 994 | if (!amount_sat_is_zero(action->in_sat)) { |
| 995 | json_add_u64(req->js, "relative_amount", |
| 996 | action->in_sat.satoshis); /* Raw: signed RPC */ |
| 997 | } else if (!amount_sat_is_zero(action->out_sat)) { |
| 998 | json_add_string(req->js, "relative_amount", |
| 999 | tal_fmt(req->js, "-%"PRIu64, |
| 1000 | action->out_sat.satoshis)); /* Raw: signed RPC */ |
| 1001 | } else { |
| 1002 | json_add_sats(req->js, "relative_amount", amount_sat(0)); |
| 1003 | } |
| 1004 | json_add_psbt(req->js, "initialpsbt", splice_cmd->psbt); |
| 1005 | json_add_u32(req->js, "feerate_per_kw", splice_cmd->feerate_per_kw); |
| 1006 | json_add_bool(req->js, "skip_stfu", true); |
| 1007 | json_add_bool(req->js, "force_feerate", splice_cmd->force_feerate); |
| 1008 | |
| 1009 | state->state = SPLICE_CMD_INIT; |
| 1010 | |
| 1011 | return send_outreq(req); |
| 1012 | } |
| 1013 | |
| 1014 | static struct command_result *splice_update_get_result(struct command *cmd, |
| 1015 | const char *methodname, |
no test coverage detected