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

Function check_nonfinal_tlv

common/onion_decode.c:18–31  ·  view source on GitHub ↗

BOLT #4: * - If `encrypted_recipient_data` is present: *... * - If it is not the final node: * - MUST return an error if the payload contains other tlv fields than * `encrypted_recipient_data` and `current_path_key`. */

Source from the content-addressed store, hash-verified

16 * `encrypted_recipient_data` and `current_path_key`.
17 */
18static bool check_nonfinal_tlv(const struct tlv_payload *tlv,
19 u64 *failtlvtype)
20{
21 for (size_t i = 0; i < tal_count(tlv->fields); i++) {
22 switch (tlv->fields[i].numtype) {
23 case TLV_PAYLOAD_CURRENT_PATH_KEY:
24 case TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA:
25 continue;
26 }
27 *failtlvtype = tlv->fields[i].numtype;
28 return false;
29 }
30 return true;
31}
32
33/* BOLT #4:
34 * - If `encrypted_recipient_data` is present:

Callers 1

handle_blinded_forwardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected