MCPcopy Create free account
hub / github.com/ElementsProject/lightning / recv_gossip

Function recv_gossip

connectd/connectd.c:1983–2000  ·  view source on GitHub ↗

~ gossipd sends us gossip to send to the peers. */

Source from the content-addressed store, hash-verified

1981
1982/*~ gossipd sends us gossip to send to the peers. */
1983static struct io_plan *recv_gossip(struct io_conn *conn,
1984 const u8 *msg,
1985 struct daemon *daemon)
1986{
1987 struct node_id dst;
1988 u8 *gossip_msg;
1989 struct peer *peer;
1990
1991 if (!fromwire_gossipd_send_gossip(msg, msg, &dst, &gossip_msg))
1992 status_failed(STATUS_FAIL_GOSSIP_IO, "Unknown msg %i",
1993 fromwire_peektype(msg));
1994
1995 peer = peer_htable_get(&daemon->peers, &dst);
1996 if (peer)
1997 inject_peer_msg(peer, take(gossip_msg));
1998
1999 return daemon_conn_read_next(conn, daemon->gossipd);
2000}
2001
2002/*~ This is a hook used by the memleak code (if DEVELOPER=1): it can't see
2003 * pointers inside hash tables, so we give it a hint here. */

Callers

nothing calls this directly

Calls 4

inject_peer_msgFunction · 0.85
daemon_conn_read_nextFunction · 0.85
status_failedFunction · 0.50
fromwire_peektypeFunction · 0.50

Tested by

no test coverage detected