Last request finished after xpay command is done gets to clean up */
| 349 | |
| 350 | /* Last request finished after xpay command is done gets to clean up */ |
| 351 | static void destroy_payment_request(struct out_req *req, |
| 352 | struct payment *payment) |
| 353 | { |
| 354 | for (size_t i = 0; i < tal_count(payment->requests); i++) { |
| 355 | if (payment->requests[i] == req) { |
| 356 | tal_arr_remove(&payment->requests, i); |
| 357 | if (tal_count(payment->requests) == 0 && payment->cmd == NULL) { |
| 358 | cleanup(req->cmd, payment); |
| 359 | } |
| 360 | return; |
| 361 | } |
| 362 | } |
| 363 | abort(); |
| 364 | } |
| 365 | |
| 366 | static struct command_result * |
| 367 | send_payment_req(struct command *aux_cmd, |