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

Function invrequest_decode

common/bolt12.c:218–246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218struct tlv_invoice_request *invrequest_decode(const tal_t *ctx,
219 const char *b12, size_t b12len,
220 const struct feature_set *our_features,
221 const struct chainparams *must_be_chain,
222 char **fail)
223{
224 struct tlv_invoice_request *invrequest;
225 const u8 *data;
226 size_t dlen;
227
228 data = string_to_data(tmpctx, b12, b12len, "lnr", &dlen, fail);
229 if (!data)
230 return NULL;
231
232 invrequest = fromwire_tlv_invoice_request(ctx, &data, &dlen);
233 if (!invrequest) {
234 *fail = tal_fmt(ctx, "invalid invoice_request data");
235 return NULL;
236 }
237
238 *fail = check_features_and_chain(ctx,
239 our_features, must_be_chain,
240 invrequest->features,
241 invrequest->chain, 1);
242 if (*fail)
243 return tal_free(invrequest);
244
245 return invrequest;
246}
247
248char *invoice_encode(const tal_t *ctx, const struct tlv_invoice *invoice_tlv)
249{

Callers 5

param_b12_invreqFunction · 0.85
invreq_doneFunction · 0.85
param_invreqFunction · 0.85
param_decodableFunction · 0.85
mainFunction · 0.85

Calls 4

string_to_dataFunction · 0.85
check_features_and_chainFunction · 0.85
tal_freeFunction · 0.85

Tested by

no test coverage detected