| 37 | } |
| 38 | |
| 39 | const 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, |
nothing calls this directly
no test coverage detected