| 303 | } |
| 304 | |
| 305 | static void tell_waiters_failed(struct lightningd *ld, |
| 306 | const struct sha256 *payment_hash, |
| 307 | const struct wallet_payment *payment, |
| 308 | enum jsonrpc_errcode pay_errcode, |
| 309 | const struct onionreply *onionreply, |
| 310 | const struct routing_failure *fail, |
| 311 | const char *details) |
| 312 | { |
| 313 | struct waitsendpay_command *pc; |
| 314 | struct waitsendpay_command *next; |
| 315 | const char *errmsg = |
| 316 | sendpay_errmsg_fmt(tmpctx, pay_errcode, fail, details); |
| 317 | |
| 318 | /* Careful: ->fail deletes cmd */ |
| 319 | list_for_each_safe(&ld->waitsendpay_commands, pc, next, list) { |
| 320 | if (!sha256_eq(payment_hash, &pc->payment_hash)) |
| 321 | continue; |
| 322 | if (payment->partid != pc->partid) |
| 323 | continue; |
| 324 | if (payment->groupid != pc->groupid) |
| 325 | continue; |
| 326 | |
| 327 | pc->fail(pc->cmd, payment, pay_errcode, onionreply, fail, errmsg, pc->arg); |
| 328 | } |
| 329 | |
| 330 | notify_sendpay_failure(ld, |
| 331 | payment, |
| 332 | pay_errcode, |
| 333 | onionreply, |
| 334 | fail, |
| 335 | errmsg); |
| 336 | } |
| 337 | |
| 338 | static void tell_waiters_success(struct lightningd *ld, |
| 339 | const struct sha256 *payment_hash, |
no test coverage detected