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

Function fmt_flows

plugins/renepay/flow.c:39–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39const char *fmt_flows(const tal_t *ctx, const struct gossmap *gossmap,
40 struct chan_extra_map *chan_extra_map,
41 struct flow **flows)
42{
43 tal_t *this_ctx = tal(ctx, tal_t);
44 char *buff = tal_fmt(ctx, "%zu subflows\n", tal_count(flows));
45 for (size_t i = 0; i < tal_count(flows); i++) {
46 struct amount_msat fee, delivered;
47 tal_append_fmt(&buff, " ");
48 for (size_t j = 0; j < tal_count(flows[i]->path); j++) {
49 struct short_channel_id scid =
50 gossmap_chan_scid(gossmap, flows[i]->path[j]);
51 tal_append_fmt(&buff, "%s%s", j ? "->" : "",
52 fmt_short_channel_id(this_ctx, scid));
53 }
54 delivered = flows[i]->amount;
55 if (!flow_fee(&fee, flows[i])) {
56 abort();
57 }
58 tal_append_fmt(&buff, " prob %.2f, %s delivered with fee %s\n",
59 flows[i]->success_prob,
60 fmt_amount_msat(this_ctx, delivered),
61 fmt_amount_msat(this_ctx, fee));
62 }
63
64 tal_free(this_ctx);
65 return buff;
66}
67
68/* Returns the greatest amount we can deliver to the destination using this
69 * route. It takes into account the current knowledge, pending HTLC,

Callers

nothing calls this directly

Calls 7

tal_append_fmtFunction · 0.85
gossmap_chan_scidFunction · 0.85
fmt_short_channel_idFunction · 0.85
abortFunction · 0.85
tal_freeFunction · 0.85
flow_feeFunction · 0.70
fmt_amount_msatFunction · 0.50

Tested by

no test coverage detected