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

Function print_fields_json

common/test/run-bolt12_proof_vectors.c:116–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

114}
115
116static void print_fields_json(const struct tlv_field *fields, size_t n,
117 bool (*include_field)(const struct tlv_field *, void *),
118 void *arg)
119{
120 for (size_t i = 0; i < n; i++) {
121 const struct tlv_field *f = &fields[i];
122 if (include_field != NULL) {
123 bool included = !is_tlv_signature_field(f)
124 && include_field(f, arg);
125 printf("{\"type\":%"PRIu64",\"len\":%zu,\"hex\":\"%s\",\"included\":%s}%s\n",
126 f->numtype, f->length,
127 tal_hexstr(tmpctx, f->value, f->length),
128 included ? "true" : "false",
129 i + 1 < n ? "," : "");
130 } else {
131 printf("{\"type\":%"PRIu64",\"len\":%zu,\"hex\":\"%s\"}%s\n",
132 f->numtype, f->length,
133 tal_hexstr(tmpctx, f->value, f->length),
134 i + 1 < n ? "," : "");
135 }
136 }
137}
138
139static void print_hashes_json(const struct sha256 *hashes, size_t n)
140{

Callers 1

generate_valid_vectorFunction · 0.85

Calls 2

is_tlv_signature_fieldFunction · 0.85
tal_hexstrFunction · 0.85

Tested by

no test coverage detected