| 100 | } |
| 101 | |
| 102 | static void node_stats(const struct route_query *rq, |
| 103 | const struct gossmap_node *node, |
| 104 | enum node_direction node_direction, |
| 105 | struct node_stats *stats) |
| 106 | { |
| 107 | memset(stats, 0, sizeof(*stats)); |
| 108 | for (size_t i = 0; i < node->num_chans; i++) { |
| 109 | int dir; |
| 110 | struct gossmap_chan *c; |
| 111 | struct amount_msat cap_msat; |
| 112 | |
| 113 | c = gossmap_nth_chan(rq->gossmap, node, i, &dir); |
| 114 | cap_msat = gossmap_chan_get_capacity(rq->gossmap, c); |
| 115 | |
| 116 | if (node_direction == INTO_NODE) |
| 117 | dir = !dir; |
| 118 | |
| 119 | add_stat(&stats->total, cap_msat); |
| 120 | if (gossmap_chan_set(c, dir)) |
| 121 | add_stat(&stats->gossip_known, cap_msat); |
| 122 | if (c->half[dir].enabled) |
| 123 | add_stat(&stats->enabled, cap_msat); |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | static const char *check_capacity(const tal_t *ctx, |
| 128 | const struct route_query *rq, |
no test coverage detected