We couldn't parse their onion, so we have no shared secret to wrap an * error with: update_fail_malformed_htlc is the only reply we can give. */
| 166 | /* We couldn't parse their onion, so we have no shared secret to wrap an |
| 167 | * error with: update_fail_malformed_htlc is the only reply we can give. */ |
| 168 | static enum onion_wire unparsable_onion_code(const struct htlc_in *hin) |
| 169 | { |
| 170 | enum onion_wire failcode; |
| 171 | |
| 172 | /* BOLT #2: |
| 173 | * - If `path_key` is set in the incoming `update_add_htlc`: |
| 174 | * - MUST send an `update_fail_malformed_htlc` error using the |
| 175 | * `invalid_onion_blinding` failure code for any local or downstream errors. |
| 176 | */ |
| 177 | if (hin->path_key) |
| 178 | return WIRE_INVALID_ONION_BLINDING; |
| 179 | |
| 180 | if (parse_onionpacket(tmpctx, hin->onion_routing_packet, |
| 181 | sizeof(hin->onion_routing_packet), &failcode)) |
| 182 | /* Should not happen: we only lack a secret if this failed */ |
| 183 | return WIRE_INVALID_ONION_VERSION; |
| 184 | return failcode; |
| 185 | } |
| 186 | |
| 187 | static struct failed_htlc *mk_failed_htlc_badonion(const tal_t *ctx, |
| 188 | const struct htlc_in *hin, |
no test coverage detected