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

Function peer_disconnect

connectd/connectd.c:2031–2051  ·  view source on GitHub ↗

lightningd tells us a peer should be disconnected. */

Source from the content-addressed store, hash-verified

2029
2030/* lightningd tells us a peer should be disconnected. */
2031static void peer_disconnect(struct daemon *daemon, const u8 *msg)
2032{
2033 struct node_id id;
2034 u64 counter;
2035 struct peer *peer;
2036
2037 if (!fromwire_connectd_disconnect_peer(msg, &id, &counter))
2038 master_badmsg(WIRE_CONNECTD_DISCONNECT_PEER, msg);
2039
2040 /* We should stay in sync with lightningd, but this can happen
2041 * under stress. */
2042 peer = peer_htable_get(daemon->peers, &id);
2043 if (!peer)
2044 return;
2045
2046 /* If it's reconnected already, it will learn soon. */
2047 if (peer->counter != counter)
2048 return;
2049
2050 disconnect_peer(peer);
2051}
2052
2053/* lightningd tells us a peer is no longer "important". */
2054static 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