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

Function json_add_datastore

lightningd/datastore.c:7–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 3

json_datastoreFunction · 0.85
json_listdatastoreFunction · 0.85
json_deldatastoreFunction · 0.85

Calls 7

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

Tested by

no test coverage detected