mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
renepay: a bit more verbose information in logs
This commit is contained in:
parent
e97e6ede41
commit
014e32ca2f
4 changed files with 44 additions and 4 deletions
|
@ -24,9 +24,10 @@ const char *fmt_chan_extra_map(const tal_t *ctx,
|
|||
const char *scid_str = fmt_short_channel_id(this_ctx, ch->scid);
|
||||
for (int dir = 0; dir < 2; ++dir) {
|
||||
tal_append_fmt(
|
||||
&buff, "%s[%d]:(%s,%s)\n", scid_str, dir,
|
||||
&buff, "%s[%d]:(%s,%s) htlc: %s\n", scid_str, dir,
|
||||
fmt_amount_msat(this_ctx, ch->half[dir].known_min),
|
||||
fmt_amount_msat(this_ctx, ch->half[dir].known_max));
|
||||
fmt_amount_msat(this_ctx, ch->half[dir].known_max),
|
||||
fmt_amount_msat(this_ctx, ch->half[dir].htlc_total));
|
||||
}
|
||||
}
|
||||
tal_free(this_ctx);
|
||||
|
|
|
@ -34,6 +34,39 @@ function_fail:
|
|||
return tal_free(amounts);
|
||||
}
|
||||
|
||||
const char *fmt_flows(const tal_t *ctx, const struct gossmap *gossmap,
|
||||
struct chan_extra_map *chan_extra_map,
|
||||
struct flow **flows)
|
||||
{
|
||||
tal_t *this_ctx = tal(ctx, tal_t);
|
||||
double tot_prob =
|
||||
flowset_probability(tmpctx, flows, gossmap, chan_extra_map, NULL);
|
||||
assert(tot_prob >= 0);
|
||||
char *buff = tal_fmt(ctx, "%zu subflows, prob %2lf\n", tal_count(flows),
|
||||
tot_prob);
|
||||
for (size_t i = 0; i < tal_count(flows); i++) {
|
||||
struct amount_msat fee, delivered;
|
||||
tal_append_fmt(&buff, " ");
|
||||
for (size_t j = 0; j < tal_count(flows[i]->path); j++) {
|
||||
struct short_channel_id scid =
|
||||
gossmap_chan_scid(gossmap, flows[i]->path[j]);
|
||||
tal_append_fmt(&buff, "%s%s", j ? "->" : "",
|
||||
fmt_short_channel_id(this_ctx, scid));
|
||||
}
|
||||
delivered = flows[i]->amount;
|
||||
if (!flow_fee(&fee, flows[i])) {
|
||||
abort();
|
||||
}
|
||||
tal_append_fmt(&buff, " prob %.2f, %s delivered with fee %s\n",
|
||||
flows[i]->success_prob,
|
||||
fmt_amount_msat(this_ctx, delivered),
|
||||
fmt_amount_msat(this_ctx, fee));
|
||||
}
|
||||
|
||||
tal_free(this_ctx);
|
||||
return buff;
|
||||
}
|
||||
|
||||
/* Returns the greatest amount we can deliver to the destination using this
|
||||
* route. It takes into account the current knowledge, pending HTLC,
|
||||
* htlc_max and fees.
|
||||
|
|
|
@ -18,6 +18,10 @@ struct flow {
|
|||
struct amount_msat amount;
|
||||
};
|
||||
|
||||
const char *fmt_flows(const tal_t *ctx, const struct gossmap *gossmap,
|
||||
struct chan_extra_map *chan_extra_map,
|
||||
struct flow **flows);
|
||||
|
||||
/* Helper to access the half chan at flow index idx */
|
||||
const struct half_chan *flow_edge(const struct flow *flow, size_t idx);
|
||||
|
||||
|
|
|
@ -97,13 +97,15 @@ function_fail:
|
|||
|
||||
const char *fmt_route_path(const tal_t *ctx, const struct route *route)
|
||||
{
|
||||
tal_t *this_ctx = tal(ctx, tal_t);
|
||||
char *s = tal_strdup(ctx, "");
|
||||
const size_t pathlen = tal_count(route->hops);
|
||||
for (size_t i = 0; i < pathlen; i++) {
|
||||
const struct short_channel_id_dir scidd =
|
||||
hop_to_scidd(&route->hops[i]);
|
||||
tal_append_fmt(&s, "-%s->",
|
||||
fmt_short_channel_id(tmpctx, scidd.scid));
|
||||
tal_append_fmt(&s, "%s%s", i ? "->" : "",
|
||||
fmt_short_channel_id(this_ctx, scidd.scid));
|
||||
}
|
||||
tal_free(this_ctx);
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue