sphinx: Return the error in parse_onionpacket

As suggested by @niftynei here: https://github.com/ElementsProject/lightning/pull/3260#discussion_r347543999

Suggested-by: Lisa Neigut <@niftynei>
Suggested-by: Rusty Russell <@rustyrussell>
Signed-off-by: Christian Decker <@cdecker>
This commit is contained in:
Christian Decker
2019-11-29 21:20:18 +01:00
parent e1b1f47c53
commit ff5f7b194f
7 changed files with 38 additions and 48 deletions

View File

@@ -148,15 +148,13 @@ u8 *serialize_onionpacket(
/**
* parse_onionpacket - Parse an onionpacket from a buffer.
*
* @ctx: tal context to allocate from
* @src: buffer to read the packet from
* @srclen: length of the @src (must be TOTAL_PACKET_SIZE)
* @why_bad: if NULL return, this is what was wrong with the packet.
* @dest: the destination into which we should parse the packet
*/
struct onionpacket *parse_onionpacket(const tal_t *ctx,
const void *src,
const size_t srclen,
enum onion_type *why_bad);
enum onion_type parse_onionpacket(const u8 *src,
const size_t srclen,
struct onionpacket *dest);
struct onionreply {
/* Node index in the path that is replying */