lightningd tells us to send a msg and disconnect. */
| 1836 | |
| 1837 | /* lightningd tells us to send a msg and disconnect. */ |
| 1838 | static void peer_final_msg(struct io_conn *conn, |
| 1839 | struct daemon *daemon, const u8 *msg) |
| 1840 | { |
| 1841 | struct peer *peer; |
| 1842 | struct node_id id; |
| 1843 | u64 counter; |
| 1844 | u8 *finalmsg; |
| 1845 | |
| 1846 | if (!fromwire_connectd_peer_final_msg(tmpctx, msg, &id, &counter, |
| 1847 | &finalmsg)) |
| 1848 | master_badmsg(WIRE_CONNECTD_PEER_FINAL_MSG, msg); |
| 1849 | |
| 1850 | /* This can happen if peer hung up on us (or wrong counter |
| 1851 | * if it reconnected). */ |
| 1852 | peer = peer_htable_get(&daemon->peers, &id); |
| 1853 | if (peer && peer->counter == counter) |
| 1854 | multiplex_final_msg(peer, take(finalmsg)); |
| 1855 | } |
| 1856 | |
| 1857 | #if DEVELOPER |
| 1858 | static void dev_connect_memleak(struct daemon *daemon, const u8 *msg) |
no test coverage detected