Cleans up a txid by doing `txdiscard` on it. */
| 164 | |
| 165 | /* Cleans up a txid by doing `txdiscard` on it. */ |
| 166 | static void |
| 167 | mfc_cleanup_psbt(struct command *cmd, |
| 168 | struct multifundchannel_cleanup *cleanup, |
| 169 | struct wally_psbt *psbt) |
| 170 | { |
| 171 | struct wally_psbt *pruned_psbt; |
| 172 | struct out_req *req = jsonrpc_request_start(cmd->plugin, |
| 173 | cmd, |
| 174 | "unreserveinputs", |
| 175 | &mfc_cleanup_done, |
| 176 | &mfc_cleanup_done, |
| 177 | cleanup); |
| 178 | |
| 179 | /* We might have peer's inputs on this, get rid of them */ |
| 180 | tal_wally_start(); |
| 181 | if (wally_psbt_clone_alloc(psbt, 0, &pruned_psbt) != WALLY_OK) |
| 182 | abort(); |
| 183 | tal_wally_end_onto(NULL, pruned_psbt, struct wally_psbt); |
| 184 | |
| 185 | for (size_t i = pruned_psbt->num_inputs - 1; |
| 186 | i < pruned_psbt->num_inputs; |
| 187 | i--) { |
| 188 | if (!psbt_input_is_ours(&pruned_psbt->inputs[i])) |
| 189 | psbt_rm_input(pruned_psbt, i); |
| 190 | } |
| 191 | |
| 192 | json_add_psbt(req->js, "psbt", take(pruned_psbt)); |
| 193 | json_add_u32(req->js, "reserve", 2016); |
| 194 | send_outreq(cmd->plugin, req); |
| 195 | } |
| 196 | |
| 197 | /* Cleans up a `openchannel_init` by doing `openchannel_abort` for the channel*/ |
| 198 | static void |
no test coverage detected