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

Function fmt_reservations

plugins/askrene/reserve.c:200–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200const char *fmt_reservations(const tal_t *ctx,
201 const struct reserve_htable *reserved,
202 const struct short_channel_id_dir *scidd,
203 const struct layer **layers)
204{
205 struct reserve *r;
206 struct reserve_htable_iter rit;
207 char *ret = NULL;
208
209 for (r = reserve_htable_getfirst(reserved, scidd, &rit);
210 r;
211 r = reserve_htable_getnext(reserved, scidd, &rit)) {
212 u64 seconds;
213 if (r->rhop.layer && !layer_in(r->rhop.layer, layers))
214 continue;
215 if (!ret)
216 ret = tal_strdup(ctx, "");
217 else
218 tal_append_fmt(&ret, ", ");
219 tal_append_fmt(&ret, "%s by command %s",
220 fmt_amount_msat(tmpctx, r->rhop.amount), r->cmd_id);
221 seconds = timemono_between(time_mono(), r->timestamp).ts.tv_sec;
222 /* Add a note if it's old */
223 if (seconds > 0)
224 tal_append_fmt(&ret, " (%"PRIu64" seconds ago)", seconds);
225 }
226 return ret;
227}

Callers 1

why_max_constrainedFunction · 0.85

Calls 5

layer_inFunction · 0.85
tal_append_fmtFunction · 0.85
timemono_betweenFunction · 0.85
time_monoFunction · 0.85
fmt_amount_msatFunction · 0.50

Tested by

no test coverage detected