BOLT #4: * - If `encrypted_recipient_data` is present: *... * - If it is the final node: * - MUST return an error if the payload contains other tlv fields than * `encrypted_recipient_data`, `current_path_key`, `amt_to_forward`, * `outgoing_cltv_value` and `total_amount_msat`. */
| 39 | * `outgoing_cltv_value` and `total_amount_msat`. |
| 40 | */ |
| 41 | static bool check_final_tlv(const struct tlv_payload *tlv, |
| 42 | u64 *failtlvtype) |
| 43 | { |
| 44 | for (size_t i = 0; i < tal_count(tlv->fields); i++) { |
| 45 | switch (tlv->fields[i].numtype) { |
| 46 | case TLV_PAYLOAD_ENCRYPTED_RECIPIENT_DATA: |
| 47 | case TLV_PAYLOAD_CURRENT_PATH_KEY: |
| 48 | case TLV_PAYLOAD_AMT_TO_FORWARD: |
| 49 | case TLV_PAYLOAD_OUTGOING_CLTV_VALUE: |
| 50 | case TLV_PAYLOAD_TOTAL_AMOUNT_MSAT: |
| 51 | continue; |
| 52 | } |
| 53 | *failtlvtype = tlv->fields[i].numtype; |
| 54 | return false; |
| 55 | } |
| 56 | return true; |
| 57 | } |
| 58 | |
| 59 | static u64 ceil_div(u64 a, u64 b) |
| 60 | { |
no outgoing calls
no test coverage detected