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

Function onionmsg_req

connectd/onion_message.c:15–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#include <wire/peer_wire.h>
14
15void onionmsg_req(struct daemon *daemon, const u8 *msg)
16{
17 struct node_id id;
18 u8 *onionmsg;
19 struct pubkey path_key;
20 struct peer *peer;
21
22 if (!fromwire_connectd_send_onionmsg(msg, msg, &id, &onionmsg, &path_key))
23 master_badmsg(WIRE_CONNECTD_SEND_ONIONMSG, msg);
24
25 /* Even though lightningd checks for valid ids, there's a race
26 * where it might vanish before we read this command. */
27 peer = peer_htable_get(daemon->peers, &id);
28 if (peer) {
29 u8 *omsg = towire_onion_message(NULL, &path_key, onionmsg);
30 inject_peer_msg(peer, take(omsg));
31 }
32}
33
34/* Source is NULL if we're injecting, otherwise it's a forward */
35static const char *handle_onion(const tal_t *ctx,

Callers 1

recv_reqFunction · 0.85

Calls 2

inject_peer_msgFunction · 0.70
master_badmsgFunction · 0.50

Tested by

no test coverage detected