diff --git a/common/nymsphinx/acknowledgements/src/surb_ack.rs b/common/nymsphinx/acknowledgements/src/surb_ack.rs index e1edd16e63..81b5ecf760 100644 --- a/common/nymsphinx/acknowledgements/src/surb_ack.rs +++ b/common/nymsphinx/acknowledgements/src/surb_ack.rs @@ -72,7 +72,8 @@ impl SURBAck { .build_packet(surb_ack_payload, &route, &destination, &delays) .unwrap(); - let expected_total_delay = delays.iter().sum(); + // in our case, the last hop is a gateway that does NOT do any delays + let expected_total_delay = delays.iter().take(delays.len() - 1).sum(); let first_hop_address = NymNodeRoutingAddress::try_from(route.first().unwrap().address).unwrap(); diff --git a/common/nymsphinx/src/preparer/mod.rs b/common/nymsphinx/src/preparer/mod.rs index 3e074b9e5f..b1fbff575e 100644 --- a/common/nymsphinx/src/preparer/mod.rs +++ b/common/nymsphinx/src/preparer/mod.rs @@ -331,7 +331,8 @@ where Ok(PreparedFragment { // the round-trip delay is the sum of delays of all hops on the forward route as // well as the total delay of the ack packet. - total_delay: delays.iter().sum::() + ack_delay, + // note that the last hop of the packet is a gateway that does not do any delays + total_delay: delays.iter().take(delays.len() - 1).sum::() + ack_delay, mix_packet: MixPacket::new(first_hop_address, sphinx_packet, self.mode), }) }