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

Function json_add_extra_fields

plugins/offers.c:994–1016  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

992}
993
994static void json_add_extra_fields(struct json_stream *js,
995 const char *fieldname,
996 const struct tlv_field *fields)
997{
998 bool have_extra = false;
999
1000 for (size_t i = 0; i < tal_count(fields); i++) {
1001 if (fields[i].meta)
1002 continue;
1003 if (!have_extra) {
1004 json_array_start(js, fieldname);
1005 have_extra = true;
1006 }
1007 json_object_start(js, NULL);
1008 json_add_u64(js, "type", fields[i].numtype);
1009 json_add_u64(js, "length", fields[i].length);
1010 json_add_hex(js, "value",
1011 fields[i].value, fields[i].length);
1012 json_object_end(js);
1013 }
1014 if (have_extra)
1015 json_array_end(js);
1016}
1017
1018static void json_add_offer(struct command *cmd, struct json_stream *js, const struct tlv_offer *offer)
1019{

Callers 4

json_add_offerFunction · 0.85
json_add_invoice_requestFunction · 0.85
json_add_b12_invoiceFunction · 0.85
json_add_payer_proofFunction · 0.85

Calls 6

json_array_startFunction · 0.85
json_object_startFunction · 0.85
json_add_u64Function · 0.85
json_add_hexFunction · 0.85
json_object_endFunction · 0.85
json_array_endFunction · 0.85

Tested by

no test coverage detected