From eff931f9cac156842dd147e66a8712e48a448c09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Fri, 24 Mar 2023 11:41:04 +0000 Subject: [PATCH] fixed network monitor --- nym-api/src/network_monitor/chunker.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nym-api/src/network_monitor/chunker.rs b/nym-api/src/network_monitor/chunker.rs index 2ac9fa04a0..efce5e92d7 100644 --- a/nym-api/src/network_monitor/chunker.rs +++ b/nym-api/src/network_monitor/chunker.rs @@ -3,6 +3,7 @@ use nym_sphinx::forwarding::packet::MixPacket; use nym_sphinx::message::NymMessage; +use nym_sphinx::params::PacketSize; use nym_sphinx::{ acknowledgements::AckKey, addressing::clients::Recipient, preparer::MessagePreparer, }; @@ -16,6 +17,7 @@ const DEFAULT_AVERAGE_ACK_DELAY: Duration = Duration::from_millis(200); #[derive(Clone)] pub(crate) struct Chunker { rng: OsRng, + packet_size: PacketSize, message_preparer: MessagePreparer, } @@ -23,6 +25,10 @@ impl Chunker { pub(crate) fn new(tested_mix_me: Recipient) -> Self { Chunker { rng: OsRng, + // no point in using anything else for monitoring + // unless we should make it variable so mixnodes wouldn't know if + // non-default packet is for measurement or not + packet_size: PacketSize::RegularPacket, message_preparer: MessagePreparer::new( OsRng, tested_mix_me, @@ -55,7 +61,7 @@ impl Chunker { let split_message = self .message_preparer - .pad_and_split_message(NymMessage::new_plain(message)); + .pad_and_split_message(NymMessage::new_plain(message), self.packet_size); let mut mix_packets = Vec::with_capacity(split_message.len()); for message_chunk in split_message {