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

Function peer_send_msg

connectd/connectd.c:2025–2042  ·  view source on GitHub ↗

lightningd tells us to send a msg. */

Source from the content-addressed store, hash-verified

2023
2024/* lightningd tells us to send a msg. */
2025static 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. */
2045static void add_scid_map(struct daemon *daemon, const u8 *msg)

Callers 1

recv_reqFunction · 0.85

Calls 2

inject_peer_msgFunction · 0.70
master_badmsgFunction · 0.50

Tested by

no test coverage detected