mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-20 02:27:51 +01:00
gossip: Replay gossip messages from the gossip_store
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
03fd5afbc5
commit
1a5a4f5853
@ -1522,6 +1522,23 @@ static void setup_listeners(struct daemon *daemon, u16 portnum)
|
||||
portnum);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function to be called whenever the master connection is idle
|
||||
*/
|
||||
static bool master_conn_idle(struct io_conn *conn UNUSED,
|
||||
struct daemon_conn *dc)
|
||||
{
|
||||
const u8 *msg;
|
||||
struct daemon *daemon = container_of(dc, struct daemon, master);
|
||||
msg = gossip_store_read_next(tmpctx, daemon->rstate->store);
|
||||
|
||||
if (msg) {
|
||||
handle_gossip_msg(daemon, msg);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse an incoming gossip init message and assign config variables
|
||||
* to the daemon.
|
||||
@ -1545,6 +1562,8 @@ static struct io_plan *gossip_init(struct daemon_conn *master,
|
||||
daemon->rstate = new_routing_state(daemon, &chain_hash, &daemon->id,
|
||||
update_channel_interval * 2);
|
||||
|
||||
master->msg_queue_cleared_cb = master_conn_idle;
|
||||
|
||||
setup_listeners(daemon, port);
|
||||
|
||||
new_reltimer(&daemon->timers, daemon,
|
||||
|
Loading…
Reference in New Issue
Block a user