askrene: move fmt_flow_full from askrene.c into flow.c.
What changed, and why it matters
This commit simply moves a helper function that formats debug logging text from one source file to another within the same plugin. There is no change to what the code does, no bug fix, and no security relevance.
No action required; this is a non-functional code-movement refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit relocates fmt_flow_full() from plugins/askrene/askrene.c to plugins/askrene/child/flow.c. The function body is copied verbatim (28 lines removed, 28 identical lines added). It is a diagnostic string-formatting routine used for verbose logging of payment flows. No logic, interfaces, or behavior are altered.
Changed components
plugins/askrene/askrene.cplugins/askrene/child/flow.cInspect captured patch +28 / −28
diff --git a/plugins/askrene/askrene.c b/plugins/askrene/askrene.c
index ff94b21a..8a4c009d 100644
--- a/plugins/askrene/askrene.c
+++ b/plugins/askrene/askrene.c
@@ -361,34 +361,6 @@ static const char *fmt_route(const tal_t *ctx,
return str;
}
-const char *fmt_flow_full(const tal_t *ctx,
- const struct route_query *rq,
- const struct flow *flow)
-{
- struct amount_msat amt = flow->delivers;
- char *str = fmt_amount_msat(ctx, flow->delivers);
-
- for (int i = tal_count(flow->path) - 1; i >= 0; i--) {
- struct short_channel_id_dir scidd;
- struct amount_msat min, max;
- scidd.scid = gossmap_chan_scid(rq->gossmap, flow->path[i]);
- scidd.dir = flow->dirs[i];
- if (!amount_msat_add_fee(&amt,
- flow->path[i]->half[scidd.dir].base_fee,
- flow->path[i]->half[scidd.dir].proportional_fee))
- abort();
- get_constraints(rq, flow->path[i], scidd.dir, &min, &max);
- tal_append_fmt(&str, " <- %s %s (cap=%s,fee=%u+%u,delay=%u)",
- fmt_amount_msat(tmpctx, amt),
- fmt_short_channel_id_dir(tmpctx, &scidd),
- fmt_amount_msat(tmpctx, max),
- flow->path[i]->half[scidd.dir].base_fee,
- flow->path[i]->half[scidd.dir].proportional_fee,
- flow->path[i]->half[scidd.dir].delay);
- }
- return str;
-}
-
enum algorithm {
/* Min. Cost Flow by successive shortests paths. */
ALGO_DEFAULT,
diff --git a/plugins/askrene/child/flow.c b/plugins/askrene/child/flow.c
index 2acd952a..05d02680 100644
--- a/plugins/askrene/child/flow.c
+++ b/plugins/askrene/child/flow.c
@@ -184,6 +184,34 @@ const char *fmt_flows_step_scid(const tal_t *ctx,
return fmt_short_channel_id_dir(ctx, &scidd);
}
+const char *fmt_flow_full(const tal_t *ctx,
+ const struct route_query *rq,
+ const struct flow *flow)
+{
+ struct amount_msat amt = flow->delivers;
+ char *str = fmt_amount_msat(ctx, flow->delivers);
+
+ for (int i = tal_count(flow->path) - 1; i >= 0; i--) {
+ struct short_channel_id_dir scidd;
+ struct amount_msat min, max;
+ scidd.scid = gossmap_chan_scid(rq->gossmap, flow->path[i]);
+ scidd.dir = flow->dirs[i];
+ if (!amount_msat_add_fee(&amt,
+ flow->path[i]->half[scidd.dir].base_fee,
+ flow->path[i]->half[scidd.dir].proportional_fee))
+ abort();
+ get_constraints(rq, flow->path[i], scidd.dir, &min, &max);
+ tal_append_fmt(&str, " <- %s %s (cap=%s,fee=%u+%u,delay=%u)",
+ fmt_amount_msat(tmpctx, amt),
+ fmt_short_channel_id_dir(tmpctx, &scidd),
+ fmt_amount_msat(tmpctx, max),
+ flow->path[i]->half[scidd.dir].base_fee,
+ flow->path[i]->half[scidd.dir].proportional_fee,
+ flow->path[i]->half[scidd.dir].delay);
+ }
+ return str;
+}
+
#ifndef SUPERVERBOSE_ENABLED
#undef SUPERVERBOSE
#endif
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.