| 7 | #include <lightningd/lightningd.h> |
| 8 | |
| 9 | static void json_add_datastore(struct json_stream *response, |
| 10 | const char **key, const u8 *data, |
| 11 | u64 generation) |
| 12 | { |
| 13 | json_array_start(response, "key"); |
| 14 | for (size_t i = 0; i < tal_count(key); i++) |
| 15 | json_add_string(response, NULL, key[i]); |
| 16 | json_array_end(response); |
| 17 | |
| 18 | if (data) { |
| 19 | const char *str; |
| 20 | |
| 21 | json_add_u64(response, "generation", generation); |
| 22 | json_add_hex(response, "hex", data, tal_bytelen(data)); |
| 23 | str = utf8_str(response, data, tal_bytelen(data)); |
| 24 | if (str) |
| 25 | json_add_string(response, "string", str); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | enum ds_mode { |
| 30 | DS_MUST_EXIST = 1, |
no test coverage detected