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