|
4 | 4 | #include <common/gossmap.h> |
5 | 5 | #include <common/route.h> |
6 | 6 | #include <plugins/askrene/askrene.h> |
| 7 | +#include <plugins/askrene/child/child_log.h> |
7 | 8 | #include <plugins/askrene/child/explain_failure.h> |
8 | 9 | #include <plugins/askrene/layer.h> |
9 | 10 | #include <plugins/askrene/reserve.h> |
@@ -133,33 +134,33 @@ static const char *check_capacity(const tal_t *ctx, |
133 | 134 |
|
134 | 135 | node_stats(rq, node, node_direction, &stats); |
135 | 136 | if (amount_msat_greater(amount, stats.total.capacity)) { |
136 | | - return rq_log(ctx, rq, LOG_DBG, |
137 | | - NO_USABLE_PATHS_STRING |
138 | | - " Total %s capacity is only %s" |
139 | | - " (in %zu channels).", |
140 | | - name, |
141 | | - fmt_amount_msat(tmpctx, stats.total.capacity), |
142 | | - stats.total.num_channels); |
| 137 | + return child_log(ctx, LOG_DBG, |
| 138 | + NO_USABLE_PATHS_STRING |
| 139 | + " Total %s capacity is only %s" |
| 140 | + " (in %zu channels).", |
| 141 | + name, |
| 142 | + fmt_amount_msat(tmpctx, stats.total.capacity), |
| 143 | + stats.total.num_channels); |
143 | 144 | } |
144 | 145 | if (amount_msat_greater(amount, stats.gossip_known.capacity)) { |
145 | | - return rq_log(ctx, rq, LOG_DBG, |
146 | | - NO_USABLE_PATHS_STRING |
147 | | - " Missing gossip for %s: only known %zu/%zu channels, leaving capacity only %s of %s.", |
148 | | - name, |
149 | | - stats.gossip_known.num_channels, |
150 | | - stats.total.num_channels, |
151 | | - fmt_amount_msat(tmpctx, stats.gossip_known.capacity), |
152 | | - fmt_amount_msat(tmpctx, stats.total.capacity)); |
| 146 | + return child_log(ctx, LOG_DBG, |
| 147 | + NO_USABLE_PATHS_STRING |
| 148 | + " Missing gossip for %s: only known %zu/%zu channels, leaving capacity only %s of %s.", |
| 149 | + name, |
| 150 | + stats.gossip_known.num_channels, |
| 151 | + stats.total.num_channels, |
| 152 | + fmt_amount_msat(tmpctx, stats.gossip_known.capacity), |
| 153 | + fmt_amount_msat(tmpctx, stats.total.capacity)); |
153 | 154 | } |
154 | 155 | if (amount_msat_greater(amount, stats.enabled.capacity)) { |
155 | | - return rq_log(ctx, rq, LOG_DBG, |
156 | | - NO_USABLE_PATHS_STRING |
| 156 | + return child_log(ctx, LOG_DBG, |
| 157 | + NO_USABLE_PATHS_STRING |
157 | 158 | " The %s has disabled %zu of %zu channels, leaving capacity only %s of %s.", |
158 | | - name, |
159 | | - stats.total.num_channels - stats.enabled.num_channels, |
160 | | - stats.total.num_channels, |
161 | | - fmt_amount_msat(tmpctx, stats.enabled.capacity), |
162 | | - fmt_amount_msat(tmpctx, stats.total.capacity)); |
| 159 | + name, |
| 160 | + stats.total.num_channels - stats.enabled.num_channels, |
| 161 | + stats.total.num_channels, |
| 162 | + fmt_amount_msat(tmpctx, stats.enabled.capacity), |
| 163 | + fmt_amount_msat(tmpctx, stats.total.capacity)); |
163 | 164 | } |
164 | 165 | return NULL; |
165 | 166 | } |
@@ -236,7 +237,7 @@ const char *explain_failure(const tal_t *ctx, |
236 | 237 | hops = route_from_dijkstra(tmpctx, rq->gossmap, dij, srcnode, |
237 | 238 | AMOUNT_MSAT(0), 0); |
238 | 239 | if (!hops) |
239 | | - return rq_log(ctx, rq, LOG_INFORM, |
| 240 | + return child_log(ctx, LOG_INFORM, |
240 | 241 | "There is no connection between source and destination at all"); |
241 | 242 |
|
242 | 243 | /* Description of shortest path */ |
@@ -282,16 +283,16 @@ const char *explain_failure(const tal_t *ctx, |
282 | 283 | else |
283 | 284 | continue; |
284 | 285 |
|
285 | | - return rq_log(ctx, rq, LOG_INFORM, |
286 | | - NO_USABLE_PATHS_STRING |
287 | | - " The shortest path is %s, but %s %s", |
288 | | - path, |
289 | | - fmt_short_channel_id_dir(tmpctx, &scidd), |
290 | | - explanation); |
| 286 | + return child_log(ctx, LOG_INFORM, |
| 287 | + NO_USABLE_PATHS_STRING |
| 288 | + " The shortest path is %s, but %s %s", |
| 289 | + path, |
| 290 | + fmt_short_channel_id_dir(tmpctx, &scidd), |
| 291 | + explanation); |
291 | 292 | } |
292 | 293 |
|
293 | | - return rq_log(ctx, rq, LOG_BROKEN, |
294 | | - "Actually, I'm not sure why we didn't find the" |
295 | | - " obvious route %s: perhaps this is a bug?", |
296 | | - path); |
| 294 | + return child_log(ctx, LOG_BROKEN, |
| 295 | + "Actually, I'm not sure why we didn't find the" |
| 296 | + " obvious route %s: perhaps this is a bug?", |
| 297 | + path); |
297 | 298 | } |
0 commit comments