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

Function json_to_route_hop_inplace

plugins/libplugin.c:2615–2635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2613}
2614
2615static bool json_to_route_hop_inplace(struct route_hop *dst, const char *buffer,
2616 const jsmntok_t *toks)
2617{
2618 const jsmntok_t *idtok = json_get_member(buffer, toks, "id");
2619 const jsmntok_t *channeltok = json_get_member(buffer, toks, "channel");
2620 const jsmntok_t *directiontok = json_get_member(buffer, toks, "direction");
2621 const jsmntok_t *amounttok = json_get_member(buffer, toks, "amount_msat");
2622 const jsmntok_t *delaytok = json_get_member(buffer, toks, "delay");
2623 const jsmntok_t *styletok = json_get_member(buffer, toks, "style");
2624
2625 if (idtok == NULL || channeltok == NULL || directiontok == NULL ||
2626 amounttok == NULL || delaytok == NULL || styletok == NULL)
2627 return false;
2628
2629 json_to_node_id(buffer, idtok, &dst->node_id);
2630 json_to_short_channel_id(buffer, channeltok, &dst->scid);
2631 json_to_int(buffer, directiontok, &dst->direction);
2632 json_to_msat(buffer, amounttok, &dst->amount);
2633 json_to_number(buffer, delaytok, &dst->delay);
2634 return true;
2635}
2636
2637struct route_hop *json_to_route(const tal_t *ctx, const char *buffer,
2638 const jsmntok_t *toks)

Callers 1

json_to_routeFunction · 0.85

Calls 6

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

Tested by

no test coverage detected