| 515 | } |
| 516 | |
| 517 | void payment_store(struct lightningd *ld, struct wallet_payment *payment TAKES) |
| 518 | { |
| 519 | struct sendpay_command *pc; |
| 520 | struct sendpay_command *next; |
| 521 | /* Need to remember here otherwise wallet_payment_store will free us. */ |
| 522 | bool ptaken = taken(payment); |
| 523 | |
| 524 | wallet_payment_store(ld->wallet, payment); |
| 525 | |
| 526 | /* Trigger any sendpay commands waiting for the store to occur. */ |
| 527 | list_for_each_safe(&ld->sendpay_commands, pc, next, list) { |
| 528 | if (!sha256_eq(&payment->payment_hash, &pc->payment_hash)) |
| 529 | continue; |
| 530 | |
| 531 | /* Deletes from list, frees pc */ |
| 532 | json_sendpay_in_progress(pc->cmd, payment); |
| 533 | } |
| 534 | |
| 535 | if (ptaken) |
| 536 | tal_free(payment); |
| 537 | } |
| 538 | |
| 539 | void payment_failed(struct lightningd *ld, const struct htlc_out *hout, |
| 540 | const char *localfail) |
no test coverage detected