BOLT #11: * * - if `x` is included: * - SHOULD use the minimum `data_length` possible. * - MUST include one `c` field (`min_final_cltv_expiry`). *... * - SHOULD use the minimum `data_length` possible. */
| 953 | * - SHOULD use the minimum `data_length` possible. |
| 954 | */ |
| 955 | static void push_varlen_field(u5 **data, char type, u64 val) |
| 956 | { |
| 957 | assert(bech32_charset_rev[(unsigned char)type] >= 0); |
| 958 | push_varlen_uint(data, bech32_charset_rev[(unsigned char)type], 5); |
| 959 | |
| 960 | for (size_t nbits = 5; nbits < 65; nbits += 5) { |
| 961 | if ((val >> nbits) == 0) { |
| 962 | push_varlen_uint(data, nbits / 5, 10); |
| 963 | push_varlen_uint(data, val, nbits); |
| 964 | return; |
| 965 | } |
| 966 | } |
| 967 | /* Can't be encoded in <= 60 bits. */ |
| 968 | abort(); |
| 969 | } |
| 970 | |
| 971 | /* BOLT #11: |
| 972 | * |
no test coverage detected