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

Function json_add_reservations

plugins/askrene/reserve.c:171–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void json_add_reservations(struct json_stream *js,
172 const struct reserve_htable *reserved,
173 const char *fieldname,
174 const struct layer **layers)
175{
176 struct reserve *r;
177 struct reserve_htable_iter rit;
178
179 json_array_start(js, fieldname);
180 for (r = reserve_htable_first(reserved, &rit);
181 r;
182 r = reserve_htable_next(reserved, &rit)) {
183 if (r->rhop.layer && !layer_in(r->rhop.layer, layers))
184 continue;
185 json_object_start(js, NULL);
186 json_add_short_channel_id_dir(js,
187 "short_channel_id_dir",
188 r->rhop.scidd);
189 json_add_amount_msat(js,
190 "amount_msat",
191 r->rhop.amount);
192 json_add_u64(js, "age_in_seconds",
193 timemono_between(time_mono(), r->timestamp).ts.tv_sec);
194 json_add_string(js, "command_id", r->cmd_id);
195 json_object_end(js);
196 }
197 json_array_end(js);
198}
199
200const char *fmt_reservations(const tal_t *ctx,
201 const struct reserve_htable *reserved,

Callers 1

Calls 11

json_array_startFunction · 0.85
layer_inFunction · 0.85
json_object_startFunction · 0.85
json_add_amount_msatFunction · 0.85
json_add_u64Function · 0.85
timemono_betweenFunction · 0.85
time_monoFunction · 0.85
json_object_endFunction · 0.85
json_array_endFunction · 0.85
json_add_stringFunction · 0.50

Tested by

no test coverage detected