MCPcopy Create free account
hub / github.com/ElementsProject/lightning / unparsable_onion_code

Function unparsable_onion_code

lightningd/peer_htlcs.c:168–185  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

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. */
168static 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
187static struct failed_htlc *mk_failed_htlc_badonion(const tal_t *ctx,
188 const struct htlc_in *hin,

Callers 2

mk_failed_htlcFunction · 0.85
local_fail_in_htlcFunction · 0.85

Calls 1

parse_onionpacketFunction · 0.85

Tested by

no test coverage detected