Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/onion_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ struct onion_payload *onion_decode(const tal_t *ctx,
size_t max = tal_bytelen(cursor), len;

p->final = (rs->nextcase == ONION_END);
p->type = rs->type;

/* BOLT #4:
* 1. type: `hop_payloads`
Expand Down
1 change: 0 additions & 1 deletion common/onion_encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include <assert.h>
#include <ccan/cast/cast.h>
#include <common/onion_encode.h>
#include <common/sphinx.h>
#include <common/utils.h>

/* BOLT #4:
Expand Down
6 changes: 1 addition & 5 deletions common/onion_encode.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
#include "config.h"
#include <bitcoin/privkey.h>
#include <common/amount.h>
#include <common/sphinx.h>

struct route_step;
struct tlv_encrypted_data_tlv_payment_relay;

enum onion_payload_type {
ONION_V0_PAYLOAD = 0,
ONION_TLV_PAYLOAD = 1,
};

struct onion_payload {
enum onion_payload_type type;
/* Is this the final hop? */
Expand Down
2 changes: 2 additions & 0 deletions common/sphinx.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,7 @@ struct route_step *process_onionpacket(
size_t legacy_max = 32;
u8 *onwire_tlv;

step->type = ONION_V0_PAYLOAD;
legacy->amt_to_forward = tal(legacy, u64);
legacy->outgoing_cltv_value = tal(legacy, u32);
legacy->short_channel_id = tal(legacy, struct short_channel_id);
Expand Down Expand Up @@ -718,6 +719,7 @@ struct route_step *process_onionpacket(
payload_size = 32;
fromwire_pad(&cursor, &max, payload_size);
} else {
step->type = ONION_TLV_PAYLOAD;
/* FIXME: raw_payload *includes* the length, which is redundant and
* means we can't just ust fromwire_tal_arrn. */
fromwire_pad(&cursor, &max, payload_size);
Expand Down
6 changes: 6 additions & 0 deletions common/sphinx.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ struct sphinx_hop {
const u8 *raw_payload;
};

enum onion_payload_type {
ONION_V0_PAYLOAD = 0,
ONION_TLV_PAYLOAD = 1,
};

struct route_step {
enum onion_payload_type type;
enum route_next_case nextcase;
struct onionpacket *next;
u8 *raw_payload;
Expand Down
Loading