Skip to content

Commit 8eb900f

Browse files
committed
askrene: move fmt_flow_full from askrene.c into flow.c.
Weird that it was in askrene.c Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 30b8179 commit 8eb900f

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

plugins/askrene/askrene.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -360,34 +360,6 @@ static const char *fmt_route(const tal_t *ctx,
360360
return str;
361361
}
362362

363-
const char *fmt_flow_full(const tal_t *ctx,
364-
const struct route_query *rq,
365-
const struct flow *flow)
366-
{
367-
struct amount_msat amt = flow->delivers;
368-
char *str = fmt_amount_msat(ctx, flow->delivers);
369-
370-
for (int i = tal_count(flow->path) - 1; i >= 0; i--) {
371-
struct short_channel_id_dir scidd;
372-
struct amount_msat min, max;
373-
scidd.scid = gossmap_chan_scid(rq->gossmap, flow->path[i]);
374-
scidd.dir = flow->dirs[i];
375-
if (!amount_msat_add_fee(&amt,
376-
flow->path[i]->half[scidd.dir].base_fee,
377-
flow->path[i]->half[scidd.dir].proportional_fee))
378-
abort();
379-
get_constraints(rq, flow->path[i], scidd.dir, &min, &max);
380-
tal_append_fmt(&str, " <- %s %s (cap=%s,fee=%u+%u,delay=%u)",
381-
fmt_amount_msat(tmpctx, amt),
382-
fmt_short_channel_id_dir(tmpctx, &scidd),
383-
fmt_amount_msat(tmpctx, max),
384-
flow->path[i]->half[scidd.dir].base_fee,
385-
flow->path[i]->half[scidd.dir].proportional_fee,
386-
flow->path[i]->half[scidd.dir].delay);
387-
}
388-
return str;
389-
}
390-
391363
enum algorithm {
392364
/* Min. Cost Flow by successive shortests paths. */
393365
ALGO_DEFAULT,

plugins/askrene/child/flow.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,34 @@ const char *fmt_flows_step_scid(const tal_t *ctx,
184184
return fmt_short_channel_id_dir(ctx, &scidd);
185185
}
186186

187+
const char *fmt_flow_full(const tal_t *ctx,
188+
const struct route_query *rq,
189+
const struct flow *flow)
190+
{
191+
struct amount_msat amt = flow->delivers;
192+
char *str = fmt_amount_msat(ctx, flow->delivers);
193+
194+
for (int i = tal_count(flow->path) - 1; i >= 0; i--) {
195+
struct short_channel_id_dir scidd;
196+
struct amount_msat min, max;
197+
scidd.scid = gossmap_chan_scid(rq->gossmap, flow->path[i]);
198+
scidd.dir = flow->dirs[i];
199+
if (!amount_msat_add_fee(&amt,
200+
flow->path[i]->half[scidd.dir].base_fee,
201+
flow->path[i]->half[scidd.dir].proportional_fee))
202+
abort();
203+
get_constraints(rq, flow->path[i], scidd.dir, &min, &max);
204+
tal_append_fmt(&str, " <- %s %s (cap=%s,fee=%u+%u,delay=%u)",
205+
fmt_amount_msat(tmpctx, amt),
206+
fmt_short_channel_id_dir(tmpctx, &scidd),
207+
fmt_amount_msat(tmpctx, max),
208+
flow->path[i]->half[scidd.dir].base_fee,
209+
flow->path[i]->half[scidd.dir].proportional_fee,
210+
flow->path[i]->half[scidd.dir].delay);
211+
}
212+
return str;
213+
}
214+
187215
#ifndef SUPERVERBOSE_ENABLED
188216
#undef SUPERVERBOSE
189217
#endif

0 commit comments

Comments
 (0)