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

Function json_to_route_hop_inplace

plugins/libplugin.c:1955–1975  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1953}
1954
1955static bool json_to_route_hop_inplace(struct route_hop *dst, const char *buffer,
1956 const jsmntok_t *toks)
1957{
1958 const jsmntok_t *idtok = json_get_member(buffer, toks, "id");
1959 const jsmntok_t *channeltok = json_get_member(buffer, toks, "channel");
1960 const jsmntok_t *directiontok = json_get_member(buffer, toks, "direction");
1961 const jsmntok_t *amounttok = json_get_member(buffer, toks, "amount_msat");
1962 const jsmntok_t *delaytok = json_get_member(buffer, toks, "delay");
1963 const jsmntok_t *styletok = json_get_member(buffer, toks, "style");
1964
1965 if (idtok == NULL || channeltok == NULL || directiontok == NULL ||
1966 amounttok == NULL || delaytok == NULL || styletok == NULL)
1967 return false;
1968
1969 json_to_node_id(buffer, idtok, &dst->node_id);
1970 json_to_short_channel_id(buffer, channeltok, &dst->scid);
1971 json_to_int(buffer, directiontok, &dst->direction);
1972 json_to_msat(buffer, amounttok, &dst->amount);
1973 json_to_number(buffer, delaytok, &dst->delay);
1974 return true;
1975}
1976
1977struct route_hop *json_to_route(const tal_t *ctx, const char *buffer,
1978 const jsmntok_t *toks)

Callers 1

json_to_routeFunction · 0.85

Calls 6

json_get_memberFunction · 0.50
json_to_node_idFunction · 0.50
json_to_short_channel_idFunction · 0.50
json_to_intFunction · 0.50
json_to_msatFunction · 0.50
json_to_numberFunction · 0.50

Tested by

no test coverage detected