| 247 | } |
| 248 | |
| 249 | static 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, |
no test coverage detected