From 71a18fdd2e2ed02937c63aec36686bb6cffe1105 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Thu, 15 Dec 2016 16:41:23 +0100 Subject: [PATCH] gossip: Trigger announce on channel establishment Since we ultimately want to have a very long re-announcement timeout we better trigger an announcement upon channel state change to normal. --- daemon/peer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daemon/peer.c b/daemon/peer.c index 8d04241a1..7e891026b 100644 --- a/daemon/peer.c +++ b/daemon/peer.c @@ -746,6 +746,7 @@ static bool open_wait_pkt_in(struct peer *peer, const Pkt *pkt) if (peer->state == STATE_OPEN_WAIT_THEIRCOMPLETE) { peer_open_complete(peer, NULL); set_peer_state(peer, STATE_NORMAL, __func__, true); + announce_channel(peer->dstate, peer); } else { set_peer_state(peer, STATE_OPEN_WAIT_ANCHORDEPTH, __func__, true); @@ -2527,6 +2528,10 @@ static struct io_plan *init_pkt_in(struct io_conn *conn, struct peer *peer) peer->inpkt = tal_free(peer->inpkt); peer_has_connected(peer); + + if (state_is_normal(peer->state)) + announce_channel(peer->dstate, peer); + return io_duplex(conn, peer_read_packet(conn, peer, pkt_in), pkt_out(conn, peer)); @@ -3311,6 +3316,7 @@ static void peer_depth_ok(struct peer *peer) case STATE_OPEN_WAIT_ANCHORDEPTH: peer_open_complete(peer, NULL); set_peer_state(peer, STATE_NORMAL, __func__, true); + announce_channel(peer->dstate, peer); break; default: log_broken(peer->log, "%s: state %s",