Skip to content

Commit 6b0196d

Browse files
f variable length onion message packet
1 parent 2ca20eb commit 6b0196d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lightning/src/ln/onion_utils.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ pub(super) fn construct_onion_packet(payloads: Vec<msgs::OnionHopData>, onion_ke
211211
/// Constructs the onion routing packet for onion messages.
212212
// NOTE: this could prob be DRY'd with `construct_onion_packet`, but it'd lead to a large-ish diff,
213213
// and it's a small method.
214-
pub(super) fn construct_onion_message_packet(payloads: Vec<onion_message::Payload>, onion_packet_keys: Vec<OnionKeys>, prng_seed: [u8; 32]) -> msgs::OnionPacket {
214+
pub(super) fn construct_onion_message_packet(payloads: Vec<onion_message::Payload>, onion_packet_keys: Vec<OnionKeys>, prng_seed: [u8; 32]) -> onion_message::Packet {
215215
// calls:
216216
// * construct_onion_packet_with_init_noise
217217
}
@@ -228,8 +228,12 @@ pub(super) fn construct_onion_packet_bogus_hopdata<HD: Writeable>(payloads: Vec<
228228
construct_onion_packet_with_init_noise(payloads, onion_keys, packet_data, associated_data)
229229
}
230230

231+
enum Packet {
232+
Payment(msgs::OnionPacket),
233+
Message(onion_message::Packet),
234+
}
231235
/// panics if route_size_insane(paylods)
232-
fn construct_onion_packet_with_init_noise<HD: Writeable>(mut payloads: Vec<HD>, onion_keys: Vec<OnionKeys>, mut packet_data: [u8; ONION_DATA_LEN], associated_data: Option<&PaymentHash>) -> msgs::OnionPacket {
236+
fn construct_onion_packet_with_init_noise<HD: Writeable>(mut payloads: Vec<HD>, onion_keys: Vec<OnionKeys>, mut packet_data: [u8; ONION_DATA_LEN], associated_data: Option<&PaymentHash>) -> Packet {
233237
// calls `onion_messages::Payload::write`
234238
let filler = {
235239
const ONION_HOP_DATA_LEN: usize = 65; // We may decrease this eventually after TLV is common

0 commit comments

Comments
 (0)