| 275 | } |
| 276 | |
| 277 | static void tell_waiters_failed(struct lightningd *ld, |
| 278 | const struct sha256 *payment_hash, |
| 279 | const struct wallet_payment *payment, |
| 280 | enum jsonrpc_errcode pay_errcode, |
| 281 | const struct onionreply *onionreply, |
| 282 | const struct routing_failure *fail, |
| 283 | const char *details) |
| 284 | { |
| 285 | struct sendpay_command *pc; |
| 286 | struct sendpay_command *next; |
| 287 | const char *errmsg = |
| 288 | sendpay_errmsg_fmt(tmpctx, pay_errcode, fail, details); |
| 289 | |
| 290 | /* Careful: sendpay_fail deletes cmd */ |
| 291 | list_for_each_safe(&ld->waitsendpay_commands, pc, next, list) { |
| 292 | if (!sha256_eq(payment_hash, &pc->payment_hash)) |
| 293 | continue; |
| 294 | if (payment->partid != pc->partid) |
| 295 | continue; |
| 296 | if (payment->groupid != pc->groupid) |
| 297 | continue; |
| 298 | |
| 299 | sendpay_fail(pc->cmd, payment, pay_errcode, onionreply, fail, |
| 300 | errmsg); |
| 301 | } |
| 302 | |
| 303 | notify_sendpay_failure(ld, |
| 304 | payment, |
| 305 | pay_errcode, |
| 306 | onionreply, |
| 307 | fail, |
| 308 | errmsg); |
| 309 | } |
| 310 | |
| 311 | static void tell_waiters_success(struct lightningd *ld, |
| 312 | const struct sha256 *payment_hash, |
no test coverage detected