lightningd tells us to send a msg. */
| 2023 | |
| 2024 | /* lightningd tells us to send a msg. */ |
| 2025 | static void peer_send_msg(struct io_conn *conn, |
| 2026 | struct daemon *daemon, const u8 *msg) |
| 2027 | { |
| 2028 | struct peer *peer; |
| 2029 | struct node_id id; |
| 2030 | u64 counter; |
| 2031 | u8 *sendmsg; |
| 2032 | |
| 2033 | if (!fromwire_connectd_peer_send_msg(tmpctx, msg, &id, &counter, |
| 2034 | &sendmsg)) |
| 2035 | master_badmsg(WIRE_CONNECTD_PEER_SEND_MSG, msg); |
| 2036 | |
| 2037 | /* This can happen if peer hung up on us (or wrong counter |
| 2038 | * if it reconnected). */ |
| 2039 | peer = peer_htable_get(daemon->peers, &id); |
| 2040 | if (peer && peer->counter == counter) |
| 2041 | inject_peer_msg(peer, take(sendmsg)); |
| 2042 | } |
| 2043 | |
| 2044 | /* lightningd tells us about a new short_channel_id for a peer. */ |
| 2045 | static void add_scid_map(struct daemon *daemon, const u8 *msg) |
no test coverage detected