| 2260 | } |
| 2261 | |
| 2262 | static struct command_result * |
| 2263 | json_spliceout(struct command *cmd, const char *buf, const jsmntok_t *params) |
| 2264 | { |
| 2265 | struct out_req *req; |
| 2266 | const char *channel, *amount, *destination; |
| 2267 | struct splice_cmd *splice_cmd; |
| 2268 | bool *force_feerate; |
| 2269 | char *script; |
| 2270 | |
| 2271 | if (!param(cmd, buf, params, |
| 2272 | p_req("channel", param_string, &channel), |
| 2273 | p_req("amount", param_string, &amount), |
| 2274 | p_opt("destination", param_string, &destination), |
| 2275 | p_opt_def("force_feerate", param_bool, &force_feerate, |
| 2276 | false), |
| 2277 | NULL)) |
| 2278 | return command_param_failed(); |
| 2279 | |
| 2280 | if (!destination) |
| 2281 | destination = "wallet"; |
| 2282 | |
| 2283 | script = tal_fmt(NULL, |
| 2284 | "%s -> %s + fee; 100%% -> %s", |
| 2285 | channel, amount, destination); |
| 2286 | |
| 2287 | splice_cmd = tal(cmd, struct splice_cmd); |
| 2288 | |
| 2289 | splice_cmd->cmd = cmd; |
| 2290 | splice_cmd->script = tal_steal(splice_cmd, script); |
| 2291 | splice_cmd->psbt = create_psbt(splice_cmd, 0, 0, 0); |
| 2292 | splice_cmd->dryrun = false; |
| 2293 | splice_cmd->wetrun = false; |
| 2294 | splice_cmd->feerate_per_kw = 0; |
| 2295 | splice_cmd->force_feerate = *force_feerate; |
| 2296 | splice_cmd->wallet_inputs_to_signed = 0; |
| 2297 | splice_cmd->fee_calculated = false; |
| 2298 | splice_cmd->initial_funds = AMOUNT_SAT(0); |
| 2299 | splice_cmd->emergency_sat = AMOUNT_SAT(0); |
| 2300 | splice_cmd->debug_log = NULL; |
| 2301 | splice_cmd->debug_counter = 0; |
| 2302 | splice_cmd->needed_funds = AMOUNT_SAT(0); |
| 2303 | memset(&splice_cmd->final_txid, 0, sizeof(splice_cmd->final_txid)); |
| 2304 | |
| 2305 | req = jsonrpc_request_start(cmd, "listpeerchannels", |
| 2306 | listpeerchannels_get_result, |
| 2307 | splice_error, splice_cmd); |
| 2308 | |
| 2309 | return send_outreq(req); |
| 2310 | } |
| 2311 | |
| 2312 | const struct plugin_command splice_commands[] = { |
| 2313 | { |
nothing calls this directly
no test coverage detected