mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
159fc7d1a2
Instead of open coding in connectd/onion_message, we move it to common with a nice API. This lets us process the BOLT test vectors. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
38 lines
1.3 KiB
C
38 lines
1.3 KiB
C
#ifndef LIGHTNING_COMMON_ONION_MESSAGE_PARSE_H
|
|
#define LIGHTNING_COMMON_ONION_MESSAGE_PARSE_H
|
|
#include "config.h"
|
|
#include <bitcoin/privkey.h>
|
|
#include <common/amount.h>
|
|
|
|
struct tlv_onionmsg_tlv;
|
|
struct node_id;
|
|
struct pubkey;
|
|
|
|
/**
|
|
* onion_message_parse: core routine to check onion_message
|
|
* @ctx: context to allocate @next_onion_msg or @final_om/@path_id off
|
|
* @onion_message_packet: Sphinx-encrypted onion
|
|
* @blinding: Blinding we were given for @onion_message_packet
|
|
* @peer: node_id of peer (for status_peer_debug msgs)
|
|
* @me: my pubkey
|
|
* @next_onion_msg (out): set if we should forward, otherwise NULL.
|
|
* @next_node_id (out): set to node id to fwd to, iff *@next_onion_msg.
|
|
* @final_om (out): set if we're the final hop, otherwise NULL.
|
|
* @final_alias (out): our alias (if *@final_om), or our own ID
|
|
* @final_path_id (out): secret enclosed, if any (iff *@final_om).
|
|
*
|
|
* Returns false if it wasn't valid.
|
|
*/
|
|
bool onion_message_parse(const tal_t *ctx,
|
|
const u8 *onion_message_packet,
|
|
const struct pubkey *blinding,
|
|
const struct node_id *peer,
|
|
const struct pubkey *me,
|
|
u8 **next_onion_msg,
|
|
struct pubkey *next_node_id,
|
|
struct tlv_onionmsg_tlv **final_om,
|
|
struct pubkey *final_alias,
|
|
struct secret **final_path_id);
|
|
|
|
#endif /* LIGHTNING_COMMON_ONION_MESSAGE_PARSE_H */
|