mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 02:27:51 +01:00
gossipd: don't ask peers for gossip until we're synced with bitcoind.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a071a754b3
commit
38124ec287
@ -1653,7 +1653,8 @@ static struct io_plan *connectd_new_peer(struct io_conn *conn,
|
||||
/* Free peer if conn closed (destroy_peer closes conn if peer freed) */
|
||||
tal_steal(peer->dc, peer);
|
||||
|
||||
/* This sends the initial timestamp filter. */
|
||||
/* This sends the initial timestamp filter (wait until we're synced!). */
|
||||
if (daemon->current_blockheight)
|
||||
setup_gossip_range(peer);
|
||||
|
||||
/* BOLT #7:
|
||||
@ -2360,6 +2361,8 @@ static struct io_plan *new_blockheight(struct io_conn *conn,
|
||||
struct daemon *daemon,
|
||||
const u8 *msg)
|
||||
{
|
||||
bool was_unknown = (daemon->current_blockheight == 0);
|
||||
|
||||
if (!fromwire_gossip_new_blockheight(msg, &daemon->current_blockheight))
|
||||
master_badmsg(WIRE_GOSSIP_NEW_BLOCKHEIGHT, msg);
|
||||
|
||||
@ -2380,6 +2383,14 @@ static struct io_plan *new_blockheight(struct io_conn *conn,
|
||||
i--;
|
||||
}
|
||||
|
||||
/* Do we need to start gossip filtering now? */
|
||||
if (was_unknown) {
|
||||
struct peer *peer;
|
||||
|
||||
list_for_each(&daemon->peers, peer, list)
|
||||
setup_gossip_range(peer);
|
||||
}
|
||||
|
||||
return daemon_conn_read_next(conn, daemon->master);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user