- construct_onion_packet_with_init_noise(payloads, onion_keys, packet_data, associated_data)
+ construct_onion_packet_with_init_noise::<_, _>(
+ payloads, onion_keys, FixedSizeOnionPacket(packet_data), Some(associated_data))
+}
+
+/// Since onion message packets and onion payment packets have different lengths but are otherwise
+/// identical, we use this trait to allow `construct_onion_packet_with_init_noise` to return either
+/// type.
+pub(crate) trait Packet {
+ type Data: AsMut<[u8]>;
+ fn new(pubkey: PublicKey, hop_data: Self::Data, hmac: [u8; 32]) -> Self;