| 992 | } |
| 993 | |
| 994 | static 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 | |
| 1018 | static void json_add_offer(struct command *cmd, struct json_stream *js, const struct tlv_offer *offer) |
| 1019 | { |
no test coverage detected