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

Function peer_disconnect

connectd/connectd.c:1976–1996  ·  view source on GitHub ↗

lightningd tells us a peer should be disconnected. */

Source from the content-addressed store, hash-verified

1974
1975/* lightningd tells us a peer should be disconnected. */
1976static void peer_disconnect(struct daemon *daemon, const u8 *msg)
1977{
1978 struct node_id id;
1979 u64 counter;
1980 struct peer *peer;
1981
1982 if (!fromwire_connectd_disconnect_peer(msg, &id, &counter))
1983 master_badmsg(WIRE_CONNECTD_DISCONNECT_PEER, msg);
1984
1985 /* We should stay in sync with lightningd, but this can happen
1986 * under stress. */
1987 peer = peer_htable_get(daemon->peers, &id);
1988 if (!peer)
1989 return;
1990
1991 /* If it's reconnected already, it will learn soon. */
1992 if (peer->counter != counter)
1993 return;
1994
1995 disconnect_peer(peer);
1996}
1997
1998/* lightningd tells us a peer is no longer "important". */
1999static void peer_downgrade(struct daemon *daemon, const u8 *msg)

Callers 1

recv_reqFunction · 0.85

Calls 2

disconnect_peerFunction · 0.85
master_badmsgFunction · 0.50

Tested by

no test coverage detected