From 32c4540fc03f7feebc39af60c26dc48801879446 Mon Sep 17 00:00:00 2001 From: Michael Schmoock Date: Sun, 8 May 2022 12:11:24 +0200 Subject: [PATCH] jsonrpc: adds dynamicaly detected IP addresses to `getinfo` Changelog-Fixed: JSON-RPC: Adds dynamically detected public IP addresses to `getinfo` --- lightningd/peer_control.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 9a0b42842..5a49f7bce 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -2014,6 +2014,12 @@ static struct command_result *json_getinfo(struct command *cmd, json_array_start(response, "address"); for (size_t i = 0; i < tal_count(cmd->ld->announceable); i++) json_add_address(response, NULL, cmd->ld->announceable+i); + if (cmd->ld->remote_addr_v4 != NULL && + !wireaddr_arr_contains(cmd->ld->announceable, cmd->ld->remote_addr_v4)) + json_add_address(response, NULL, cmd->ld->remote_addr_v4); + if (cmd->ld->remote_addr_v6 != NULL && + !wireaddr_arr_contains(cmd->ld->announceable, cmd->ld->remote_addr_v6)) + json_add_address(response, NULL, cmd->ld->remote_addr_v6); json_array_end(response); /* This is what we're actually bound to. */