lightningd tells us to send a msg. */
| 2078 | |
| 2079 | /* lightningd tells us to send a msg. */ |
| 2080 | static void peer_send_msg(struct io_conn *conn, |
| 2081 | struct daemon *daemon, const u8 *msg) |
| 2082 | { |
| 2083 | struct peer *peer; |
| 2084 | struct node_id id; |
| 2085 | u64 counter; |
| 2086 | u8 *sendmsg; |
| 2087 | |
| 2088 | if (!fromwire_connectd_peer_send_msg(tmpctx, msg, &id, &counter, |
| 2089 | &sendmsg)) |
| 2090 | master_badmsg(WIRE_CONNECTD_PEER_SEND_MSG, msg); |
| 2091 | |
| 2092 | /* This can happen if peer hung up on us (or wrong counter |
| 2093 | * if it reconnected). */ |
| 2094 | peer = peer_htable_get(daemon->peers, &id); |
| 2095 | if (peer && peer->counter == counter) |
| 2096 | inject_peer_msg(peer, take(sendmsg)); |
| 2097 | } |
| 2098 | |
| 2099 | /* lightningd tells us about a new short_channel_id for a peer. */ |
| 2100 | static void add_scid_map(struct daemon *daemon, const u8 *msg) |
no test coverage detected