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

Function decode_d

common/bolt11.c:200–220  ·  view source on GitHub ↗

BOLT #11: * * `d` (13): `data_length` variable. Short description of purpose of payment * (UTF-8), e.g. '1 cup of coffee' or 'ナンセンス 1杯' */

Source from the content-addressed store, hash-verified

198 * (UTF-8), e.g. '1 cup of coffee' or 'ナンセンス 1杯'
199 */
200static const char *decode_d(struct bolt11 *b11,
201 const struct feature_set *our_features,
202 struct hash_u5 *hu5,
203 const u5 **data, size_t *field_len,
204 bool *have_d)
205{
206 u8 *desc;
207 const char *err;
208
209 assert(!*have_d);
210 desc = pull_all(NULL, hu5, data, field_len, false, &err);
211 if (!desc)
212 return err;
213
214 *have_d = true;
215 b11->description = utf8_str(b11, take(desc), tal_bytelen(desc));
216 if (b11->description)
217 return NULL;
218
219 return tal_fmt(b11, "d: invalid utf8");
220}
221
222/* BOLT #11:
223 *

Callers

nothing calls this directly

Calls 3

pull_allFunction · 0.85
utf8_strFunction · 0.85
tal_bytelenFunction · 0.85

Tested by

no test coverage detected