bolt11.h (1208B)
1 #ifndef LIGHTNING_COMMON_BOLT11_H 2 #define LIGHTNING_COMMON_BOLT11_H 3 /* Borrowed from CLN's common/bolt11.[ch] implementation as of v24.08rc1 */ 4 5 #include "ccan/short_types/short_types.h" 6 #include "hash_u5.h" 7 #include "amount.h" 8 #include "ccan/list/list.h" 9 #include "amount.h" 10 #include "node_id.h" 11 12 /* We only have 10 bits for the field length, meaning < 640 bytes */ 13 #define BOLT11_FIELD_BYTE_LIMIT ((1 << 10) * 5 / 8) 14 15 /* BOLT #11: 16 * * `c` (24): `data_length` variable. 17 * `min_final_cltv_expiry` to use for the last HTLC in the route. 18 * Default is 18 if not specified. 19 */ 20 #define DEFAULT_FINAL_CLTV_DELTA 18 21 22 struct feature_set; 23 24 struct bolt11_field { 25 struct list_node list; 26 27 char tag; 28 u5 *data; 29 }; 30 31 struct bolt11 { 32 u64 timestamp; 33 struct amount_msat *msat; /* NULL if not specified. */ 34 35 /* description_hash valid if and only if description is NULL. */ 36 const char *description; 37 struct sha256 *description_hash; 38 39 /* How many seconds to pay from @timestamp above. */ 40 u64 expiry; 41 }; 42 43 /* Does not check signature, nor extract node. */ 44 struct bolt11 *bolt11_decode_minimal(const tal_t *ctx, const char *str, char **fail); 45 46 #endif /* LIGHTNING_COMMON_BOLT11_H */