| 25 | static u8 empty_map[] = {10}; |
| 26 | |
| 27 | static const char *print_flows(const tal_t *ctx, const char *desc, |
| 28 | const struct gossmap *gossmap, |
| 29 | struct chan_extra_map *chan_extra_map, |
| 30 | struct flow **flows) |
| 31 | { |
| 32 | tal_t *this_ctx = tal(ctx, tal_t); |
| 33 | double tot_prob = |
| 34 | flowset_probability(tmpctx, flows, gossmap, chan_extra_map, false, NULL); |
| 35 | assert(tot_prob >= 0); |
| 36 | char *buff = tal_fmt(ctx, "%s: %zu subflows, prob %2lf\n", desc, |
| 37 | tal_count(flows), tot_prob); |
| 38 | for (size_t i = 0; i < tal_count(flows); i++) { |
| 39 | struct amount_msat fee, delivered; |
| 40 | tal_append_fmt(&buff, " "); |
| 41 | for (size_t j = 0; j < tal_count(flows[i]->path); j++) { |
| 42 | struct short_channel_id scid = |
| 43 | gossmap_chan_scid(gossmap, flows[i]->path[j]); |
| 44 | tal_append_fmt(&buff, "%s%s", j ? "->" : "", |
| 45 | fmt_short_channel_id(this_ctx, scid)); |
| 46 | } |
| 47 | delivered = flows[i]->amount; |
| 48 | if (!flow_fee(&fee, flows[i])) { |
| 49 | abort(); |
| 50 | } |
| 51 | tal_append_fmt(&buff, " prob %.2f, %s delivered with fee %s\n", |
| 52 | flows[i]->success_prob, |
| 53 | fmt_amount_msat(this_ctx, delivered), |
| 54 | fmt_amount_msat(this_ctx, fee)); |
| 55 | } |
| 56 | |
| 57 | tal_free(this_ctx); |
| 58 | return buff; |
| 59 | } |
| 60 | |
| 61 | #define NUM_NODES 8 |
| 62 |
no test coverage detected