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