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.
This commit is contained in:
Christian Decker 2016-12-15 16:41:23 +01:00 committed by Rusty Russell
parent e54c0adced
commit 71a18fdd2e

View File

@ -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",