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

Function node_stats

plugins/askrene/child/explain_failure.c:102–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100}
101
102static 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
127static const char *check_capacity(const tal_t *ctx,
128 const struct route_query *rq,

Callers 1

check_capacityFunction · 0.70

Calls 4

gossmap_nth_chanFunction · 0.85
add_statFunction · 0.85
gossmap_chan_setFunction · 0.85

Tested by

no test coverage detected