This is used for cases where we can immediately fail the HTLC. */
| 309 | |
| 310 | /* This is used for cases where we can immediately fail the HTLC. */ |
| 311 | void local_fail_in_htlc(struct htlc_in *hin, const u8 *failmsg TAKES) |
| 312 | { |
| 313 | struct onionreply *failonion; |
| 314 | |
| 315 | /* We failed it for another reason (shutting down, dust) before |
| 316 | * noticing the onion was bad: we can only say it was malformed. */ |
| 317 | if (!hin->shared_secret) { |
| 318 | tal_free_if_taken(failmsg); |
| 319 | local_fail_in_htlc_badonion(hin, unparsable_onion_code(hin)); |
| 320 | return; |
| 321 | } |
| 322 | |
| 323 | failonion = create_onionreply(NULL, hin->shared_secret, failmsg); |
| 324 | tal_free_if_taken(failmsg); |
| 325 | |
| 326 | fail_in_htlc(hin, take(failonion)); |
| 327 | } |
| 328 | |
| 329 | /* Helper to create (common) WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS */ |
| 330 | const u8 *failmsg_incorrect_or_unknown(const tal_t *ctx, |
no test coverage detected