Skip to content

Commit 8bf018f

Browse files
cdeckerrustyrussell
authored andcommitted
pay: Inject channel_hints we receive via plugin notifications
Making sure that we don't accidentally create an endless loop.
1 parent 4a29773 commit 8bf018f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

plugins/pay.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,9 +1518,16 @@ static struct command_result *handle_channel_hint_update(struct command *cmd,
15181518
{
15191519
struct channel_hint *hint = channel_hint_from_json(NULL, buf, param);
15201520

1521-
plugin_log(cmd->plugin, LOG_DBG, "Received a channel_hint for scidd=%s",
1522-
fmt_short_channel_id_dir(tmpctx, &hint->scid));
1523-
/* TODO: Apply the change to the channel_hint_set in `hints` */
1521+
plugin_log(cmd->plugin, LOG_DBG,
1522+
"Received a channel_hint {.scid = %s, .enabled = %d, "
1523+
".estimate = %s, .capacity = %s }",
1524+
fmt_short_channel_id_dir(tmpctx, &hint->scid), hint->enabled,
1525+
fmt_amount_msat(tmpctx, hint->estimated_capacity),
1526+
fmt_amount_sat(tmpctx, hint->capacity)
1527+
);
1528+
channel_hint_set_add(global_hints, time_now().ts.tv_sec, &hint->scid,
1529+
hint->enabled, &hint->estimated_capacity,
1530+
hint->capacity, NULL);
15241531
tal_free(hint);
15251532
return notification_handled(cmd);
15261533
}

0 commit comments

Comments
 (0)