| 17 | #include <wire/peer_wire.h> |
| 18 | |
| 19 | void onionmsg_req(struct daemon *daemon, const u8 *msg) |
| 20 | { |
| 21 | struct node_id id; |
| 22 | u8 *onionmsg; |
| 23 | struct pubkey blinding; |
| 24 | struct peer *peer; |
| 25 | |
| 26 | if (!fromwire_connectd_send_onionmsg(msg, msg, &id, &onionmsg, &blinding)) |
| 27 | master_badmsg(WIRE_CONNECTD_SEND_ONIONMSG, msg); |
| 28 | |
| 29 | /* Even though lightningd checks for valid ids, there's a race |
| 30 | * where it might vanish before we read this command. */ |
| 31 | peer = peer_htable_get(&daemon->peers, &id); |
| 32 | if (peer) { |
| 33 | u8 *omsg = towire_onion_message(NULL, &blinding, onionmsg); |
| 34 | inject_peer_msg(peer, take(omsg)); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /* Peer sends an onion msg. */ |
| 39 | void handle_onion_message(struct daemon *daemon, |
no test coverage detected