| 1262 | } |
| 1263 | |
| 1264 | static struct command_result *handle_wetrun(struct command *cmd, |
| 1265 | struct splice_cmd *splice_cmd) |
| 1266 | { |
| 1267 | struct out_req *req; |
| 1268 | struct abort_pkg *abort_pkg; |
| 1269 | size_t added; |
| 1270 | |
| 1271 | abort_pkg = tal(cmd->plugin, struct abort_pkg); |
| 1272 | abort_pkg->splice_cmd = tal_steal(abort_pkg, splice_cmd); |
| 1273 | abort_pkg->str = NULL; |
| 1274 | |
| 1275 | req = jsonrpc_request_start(cmd, "abort_channels", |
| 1276 | abort_get_result, forward_error, abort_pkg); |
| 1277 | |
| 1278 | added = 0; |
| 1279 | json_array_start(req->js, "channel_ids"); |
| 1280 | for (size_t i = 0; i < tal_count(splice_cmd->actions); i++) { |
| 1281 | if (splice_cmd->actions[i]->channel_id) { |
| 1282 | added++; |
| 1283 | json_add_channel_id(req->js, NULL, |
| 1284 | splice_cmd->actions[i]->channel_id); |
| 1285 | } |
| 1286 | } |
| 1287 | json_array_end(req->js); |
| 1288 | |
| 1289 | if (!added) |
| 1290 | return unreserve_get_result(cmd, NULL, NULL, NULL, abort_pkg); |
| 1291 | |
| 1292 | return send_outreq(req); |
| 1293 | } |
| 1294 | |
| 1295 | /* Before calling, ensure `onchain_fee` is accounted for in `needed_funds`. |
| 1296 | * |
no test coverage detected