lightningd tells us a peer should be disconnected. */
| 2029 | |
| 2030 | /* lightningd tells us a peer should be disconnected. */ |
| 2031 | static 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". */ |
| 2054 | static void peer_downgrade(struct daemon *daemon, const u8 *msg) |
no test coverage detected