| 189 | enum onion_wire badonion); |
| 190 | |
| 191 | static struct failed_htlc *mk_failed_htlc(const tal_t *ctx, |
| 192 | const struct htlc_in *hin, |
| 193 | const struct onionreply *failonion) |
| 194 | { |
| 195 | struct failed_htlc *f; |
| 196 | |
| 197 | if (!hin->shared_secret) { |
| 198 | log_broken(hin->key.channel->log, |
| 199 | "HTLC %"PRIu64" has no shared secret:" |
| 200 | " failing it as malformed instead", |
| 201 | hin->key.id); |
| 202 | return mk_failed_htlc_badonion(ctx, hin, |
| 203 | unparsable_onion_code(hin)); |
| 204 | } |
| 205 | |
| 206 | f = tal(ctx, struct failed_htlc); |
| 207 | |
| 208 | /* Inside a blinded path, override return */ |
| 209 | if (blind_error_return(hin)) { |
| 210 | struct sha256 sha; |
| 211 | sha256(&sha, hin->onion_routing_packet, |
| 212 | sizeof(hin->onion_routing_packet)); |
| 213 | failonion = create_onionreply(tmpctx, hin->shared_secret, |
| 214 | towire_invalid_onion_blinding(tmpctx, &sha)); |
| 215 | } |
| 216 | |
| 217 | f->id = hin->key.id; |
| 218 | f->sha256_of_onion = NULL; |
| 219 | f->badonion = 0; |
| 220 | /* Wrap onion error */ |
| 221 | f->onion = wrap_onionreply(f, hin->shared_secret, failonion); |
| 222 | |
| 223 | return f; |
| 224 | } |
| 225 | |
| 226 | static struct failed_htlc *mk_failed_htlc_badonion(const tal_t *ctx, |
| 227 | const struct htlc_in *hin, |
no test coverage detected