From 40367b4b33aa6ccad105618774d32a28f38a3329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Wed, 9 Nov 2022 16:01:16 +0000 Subject: [PATCH] Made sphinx packet builder more generic --- src/packet/builder.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/packet/builder.rs b/src/packet/builder.rs index 25c7cf8..9aa9310 100644 --- a/src/packet/builder.rs +++ b/src/packet/builder.rs @@ -28,9 +28,9 @@ impl<'a> SphinxPacketBuilder<'a> { self } - pub fn build_packet( + pub fn build_packet>( &self, - message: Vec, + message: M, route: &[Node], destination: &Destination, delays: &[Delay], @@ -41,7 +41,8 @@ impl<'a> SphinxPacketBuilder<'a> { }; // no need to check if plaintext has correct length as this check is already performed in payload encapsulation - let payload = Payload::encapsulate_message(&message, &payload_keys, self.payload_size)?; + let payload = + Payload::encapsulate_message(message.as_ref(), &payload_keys, self.payload_size)?; Ok(SphinxPacket { header, payload }) } }