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

Function json_add_extra_fields

plugins/offers.c:996–1018  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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