diff --git a/common/onion_decode.c b/common/onion_decode.c index 285c634c301b..a2a2f5805445 100644 --- a/common/onion_decode.c +++ b/common/onion_decode.c @@ -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` diff --git a/common/onion_encode.c b/common/onion_encode.c index 2b817e1842e3..d52b6d78378c 100644 --- a/common/onion_encode.c +++ b/common/onion_encode.c @@ -2,7 +2,6 @@ #include #include #include -#include #include /* BOLT #4: diff --git a/common/onion_encode.h b/common/onion_encode.h index a570b0d098d7..a6fb2cb04e97 100644 --- a/common/onion_encode.h +++ b/common/onion_encode.h @@ -3,15 +3,11 @@ #include "config.h" #include #include +#include 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? */ diff --git a/common/sphinx.c b/common/sphinx.c index 6ac128d9a7a1..d5f0e76129b2 100644 --- a/common/sphinx.c +++ b/common/sphinx.c @@ -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); @@ -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); diff --git a/common/sphinx.h b/common/sphinx.h index b559d61a85e9..cfd02db10411 100644 --- a/common/sphinx.h +++ b/common/sphinx.h @@ -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;