Skip to content

Commit

Permalink
pay: Inject channel_hints we receive via plugin notifications
Browse files Browse the repository at this point in the history
Making sure that we don't accidentally create an endless loop.
  • Loading branch information
cdecker committed Aug 23, 2024
1 parent 268d11f commit 954eea3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plugins/pay.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,9 +1518,16 @@ static struct command_result *handle_channel_hint_update(struct command *cmd,
{
struct channel_hint *hint = channel_hint_from_json(NULL, buf, param);

plugin_log(cmd->plugin, LOG_DBG, "Received a channel_hint for scidd=%s",
fmt_short_channel_id_dir(tmpctx, &hint->scid));
/* TODO: Apply the change to the channel_hint_set in `hints` */
plugin_log(cmd->plugin, LOG_DBG,
"Received a channel_hint {.scid = %s, .enabled = %d, "
".estimate = %s, .capacity = %s }",
fmt_short_channel_id_dir(tmpctx, &hint->scid), hint->enabled,
fmt_amount_msat(tmpctx, hint->estimated_capacity),
fmt_amount_sat(tmpctx, hint->capacity)
);
channel_hint_set_add(global_hints, time_now().ts.tv_sec, &hint->scid,
hint->enabled, &hint->estimated_capacity,
hint->capacity, NULL);
tal_free(hint);
return notification_handled(cmd);
}
Expand Down

0 comments on commit 954eea3

Please sign in to comment.