Skip to content

Commit

Permalink
peer_control: send addrhints in activate_peer
Browse files Browse the repository at this point in the history
Since we now have addresses in the database, we can resend them as hints to
gossipd on startup.

Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 authored and cdecker committed Jan 12, 2018
1 parent 6b7b7f1 commit 2e796ff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lightningd/peer_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -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?",
Expand All @@ -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));
}
}
Expand Down

0 comments on commit 2e796ff

Please sign in to comment.