From 2e796ffa67ffc131b19fe6a337fe96f3900b91b3 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Wed, 10 Jan 2018 22:19:53 -0800 Subject: [PATCH] peer_control: send addrhints in activate_peer Since we now have addresses in the database, we can resend them as hints to gossipd on startup. Signed-off-by: William Casarin --- lightningd/peer_control.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 6ad027435335..5c507b196217 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -2720,8 +2720,14 @@ const char *peer_state_name(enum peer_state state) static void activate_peer(struct peer *peer) { + u8 *msg; + assert(!peer->owner); + /* Pass gossipd any addrhints we currently have */ + msg = towire_gossipctl_peer_addrhint(peer, &peer->id, &peer->addr); + subd_send_msg(peer->ld->gossip, take(msg)); + /* FIXME: We should never have these in the database! */ if (!peer->funding_txid) { log_broken(peer->log, "activate_peer(%s) with no funding txid?", @@ -2737,7 +2743,7 @@ static void activate_peer(struct peer *peer) funding_spent, NULL); if (peer_wants_reconnect(peer)) { - u8 *msg = towire_gossipctl_reach_peer(peer, &peer->id); + msg = towire_gossipctl_reach_peer(peer, &peer->id); subd_send_msg(peer->ld->gossip, take(msg)); } }