From 221fe8c5f392b3a95df4a2f38e21ccc7776dfaad Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sat, 19 Aug 2017 15:05:05 +0200 Subject: [PATCH] reconnect: Re-assign peer->netaddr on reconnect, could have changed Signed-off-by: Christian Decker --- lightningd/peer_control.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index abae20c84..23fe9e213 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -433,6 +433,11 @@ static bool peer_reconnected(struct lightningd *ld, log_info(peer->log, "Peer has reconnected, state %s", peer_state_name(peer->state)); + /* FIXME: Don't assume protocol here! */ + if (!netaddr_from_fd(fd, SOCK_STREAM, IPPROTO_TCP, &peer->netaddr)) { + log_unusual(ld->log, "Failed to get netaddr for peer: %s", + strerror(errno)); + } /* BOLT #2: * * On reconnection, if a channel is in an error state, the node SHOULD