From c04aaa1c5543a7519239f2714aad746e954d7377 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 9 Dec 2025 14:42:25 +1030 Subject: [PATCH 1/2] common: remove unused type field. We always use modern TLV style: in fact, this field was never set! Signed-off-by: Rusty Russell --- common/onion_encode.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/common/onion_encode.h b/common/onion_encode.h index a570b0d098d7..ac1acadce0a7 100644 --- a/common/onion_encode.h +++ b/common/onion_encode.h @@ -7,13 +7,7 @@ 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? */ bool final; From e74861ac9b9fc7c0ff4eb3a75747fb38bc558ff9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 9 Dec 2025 14:43:13 +1030 Subject: [PATCH 2/2] common: remove legacy onion translation. This was added in 24.05, but LND since 0.18.3 no longer ever creates such onions, and even that version (September 2024) is now a long way behind. Signed-off-by: Rusty Russell Changelog-Removed: Protocol: we no longer support legacy onions (never sent by LND >= 0.18.3, which was the last) --- common/sphinx.c | 53 ++++++------------------------------------------- 1 file changed, 6 insertions(+), 47 deletions(-) diff --git a/common/sphinx.c b/common/sphinx.c index 6ac128d9a7a1..5cecf68777b5 100644 --- a/common/sphinx.c +++ b/common/sphinx.c @@ -677,54 +677,13 @@ struct route_step *process_onionpacket( /* Any of these could fail, falling thru with cursor == NULL */ payload_size = fromwire_bigsize(&cursor, &max); - /* Legacy! 0 length payload means fixed 32 byte structure */ - if (payload_size == 0 && max >= 32) { - struct tlv_payload *legacy = tlv_payload_new(tmpctx); - const u8 *legacy_cursor = cursor; - size_t legacy_max = 32; - u8 *onwire_tlv; - - legacy->amt_to_forward = tal(legacy, u64); - legacy->outgoing_cltv_value = tal(legacy, u32); - legacy->short_channel_id = tal(legacy, struct short_channel_id); - - /* BOLT-obsolete #4: - * ## Legacy `hop_data` payload format - * - * The `hop_data` format is identified by a single `0x00`-byte - * length, for backward compatibility. Its payload is defined - * as: - * - * 1. type: `hop_data` (for `realm` 0) - * 2. data: - * * [`short_channel_id`:`short_channel_id`] - * * [`u64`:`amt_to_forward`] - * * [`u32`:`outgoing_cltv_value`] - * * [`12*byte`:`padding`] - */ - *legacy->short_channel_id = fromwire_short_channel_id(&legacy_cursor, &legacy_max); - *legacy->amt_to_forward = fromwire_u64(&legacy_cursor, &legacy_max); - *legacy->outgoing_cltv_value = fromwire_u32(&legacy_cursor, &legacy_max); - - /* Re-linearize it as a modern TLV! */ - onwire_tlv = tal_arr(tmpctx, u8, 0); - towire_tlv_payload(&onwire_tlv, legacy); - - /* Length, then tlv */ - step->raw_payload = tal_arr(step, u8, 0); - towire_bigsize(&step->raw_payload, tal_bytelen(onwire_tlv)); - towire_u8_array(&step->raw_payload, onwire_tlv, tal_bytelen(onwire_tlv)); + /* 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); + if (cursor != NULL) + step->raw_payload = tal_dup_arr(step, u8, paddedheader, + cursor - paddedheader, 0); - payload_size = 32; - fromwire_pad(&cursor, &max, payload_size); - } else { - /* 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); - if (cursor != NULL) - step->raw_payload = tal_dup_arr(step, u8, paddedheader, - cursor - paddedheader, 0); - } fromwire_hmac(&cursor, &max, &step->next->hmac); /* BOLT #4: