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

Function json_to_listpeers_result

plugins/libplugin.c:1898–1921  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1896}
1897
1898struct listpeers_result *json_to_listpeers_result(const tal_t *ctx,
1899 const char *buffer,
1900 const jsmntok_t *toks)
1901{
1902 size_t i;
1903 const jsmntok_t *iter;
1904 struct listpeers_result *res;
1905 const jsmntok_t *peerstok = json_get_member(buffer, toks, "peers");
1906
1907 if (peerstok == NULL || peerstok->type != JSMN_ARRAY)
1908 return NULL;
1909
1910 res = tal(ctx, struct listpeers_result);
1911 res->peers = tal_arr(res, struct listpeers_peer *, 0);
1912
1913 json_for_each_obj(i, iter, peerstok) {
1914 struct listpeers_peer *p =
1915 json_to_listpeers_peer(res, buffer, iter);
1916 if (p == NULL)
1917 return tal_free(res);
1918 tal_arr_expand(&res->peers, p);
1919 }
1920 return res;
1921}
1922
1923struct createonion_response *json_to_createonion_response(const tal_t *ctx,
1924 const char *buffer,

Callers 1

direct_pay_listpeersFunction · 0.70

Calls 3

json_to_listpeers_peerFunction · 0.85
tal_freeFunction · 0.85
json_get_memberFunction · 0.50

Tested by

no test coverage detected