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

Function get_capacities

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

Source from the content-addressed store, hash-verified

198}
199
200static fp16_t *get_capacities(const tal_t *ctx,
201 struct plugin *plugin, struct gossmap *gossmap)
202{
203 fp16_t *caps;
204 struct gossmap_chan *c;
205
206 caps = tal_arrz(ctx, fp16_t, gossmap_max_chan_idx(gossmap));
207
208 for (c = gossmap_first_chan(gossmap);
209 c;
210 c = gossmap_next_chan(gossmap, c)) {
211 struct amount_msat cap;
212
213 cap = gossmap_chan_get_capacity(gossmap, c);
214 /* Pessimistic: round down! */
215 caps[gossmap_chan_idx(gossmap, c)]
216 = u64_to_fp16(cap.millisatoshis/1000, false); /* Raw: fp16 */
217 }
218 return caps;
219}
220
221/* If we're the payer, we don't add delay or fee to our own outgoing
222 * 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