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

Function get_capacities

plugins/askrene/askrene.c:249–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

247}
248
249static fp16_t *get_capacities(const tal_t *ctx,
250 struct plugin *plugin, struct gossmap *gossmap)
251{
252 fp16_t *caps;
253 struct gossmap_chan *c;
254
255 caps = tal_arrz(ctx, fp16_t, gossmap_max_chan_idx(gossmap));
256
257 for (c = gossmap_first_chan(gossmap);
258 c;
259 c = gossmap_next_chan(gossmap, c)) {
260 struct amount_msat cap;
261
262 cap = gossmap_chan_get_capacity(gossmap, c);
263 /* Pessimistic: round down! */
264 caps[gossmap_chan_idx(gossmap, c)]
265 = u64_to_fp16(cap.millisatoshis/1000, false); /* Raw: fp16 */
266 }
267 return caps;
268}
269
270/* If we're the payer, we don't add delay or fee to our own outgoing
271 * channels. This wouldn't be right if we looped back through ourselves,

Callers 2

do_getroutesFunction · 0.85
initFunction · 0.85

Calls 6

gossmap_max_chan_idxFunction · 0.85
gossmap_first_chanFunction · 0.85
gossmap_next_chanFunction · 0.85
gossmap_chan_idxFunction · 0.85
u64_to_fp16Function · 0.85

Tested by

no test coverage detected