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

Function json_add_datastore

lightningd/datastore.c:9–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include <lightningd/lightningd.h>
8
9static 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
29enum ds_mode {
30 DS_MUST_EXIST = 1,

Callers 3

json_datastoreFunction · 0.85
json_listdatastoreFunction · 0.85
json_deldatastoreFunction · 0.85

Calls 7

json_add_hexFunction · 0.85
tal_bytelenFunction · 0.85
utf8_strFunction · 0.85
json_array_startFunction · 0.50
json_add_stringFunction · 0.50
json_array_endFunction · 0.50
json_add_u64Function · 0.50

Tested by

no test coverage detected