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

Function peer_send_msg

connectd/connectd.c:2080–2097  ·  view source on GitHub ↗

lightningd tells us to send a msg. */

Source from the content-addressed store, hash-verified

2078
2079/* lightningd tells us to send a msg. */
2080static 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. */
2100static 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