Changes due to updated sphinx

This commit is contained in:
Jedrzej Stuczynski
2020-02-27 13:08:25 +00:00
parent 8c6744dd96
commit c71a1ae71d
3 changed files with 9 additions and 10 deletions
Generated
+1 -1
View File
@@ -2271,7 +2271,7 @@ dependencies = [
[[package]]
name = "sphinx"
version = "0.1.0"
source = "git+https://github.com/nymtech/sphinx?rev=e5d91f87a6a9dbfc192a029e834b39a42768e9ce#e5d91f87a6a9dbfc192a029e834b39a42768e9ce"
source = "git+https://github.com/nymtech/sphinx?rev=4e51ed38a5de6fcb454c8903f1fe5e6b52720c77#4e51ed38a5de6fcb454c8903f1fe5e6b52720c77"
dependencies = [
"aes-ctr",
"arrayref",
+1 -1
View File
@@ -238,7 +238,7 @@ impl PathChecker {
// we already checked for 'None' case
let first_node_client = first_node_client.as_ref().unwrap();
let delays: Vec<_> = path.iter().map(|_| Delay::new(0)).collect();
let delays: Vec<_> = path.iter().map(|_| Delay::new_from_nanos(0)).collect();
// all of the data used to create the packet was created by us
let packet = sphinx::SphinxPacket::new(
+7 -8
View File
@@ -5,10 +5,10 @@ use log::*;
use sphinx::header::delays::Delay as SphinxDelay;
use sphinx::route::NodeAddressBytes;
use sphinx::{ProcessedPacket, SphinxPacket};
use std::net::SocketAddr;
use std::ops::Deref;
use std::sync::Arc;
use std::time::Duration;
use std::net::SocketAddr;
#[derive(Debug)]
pub enum MixProcessingError {
@@ -40,7 +40,6 @@ impl From<addressing::AddressTypeError> for MixProcessingError {
}
}
// PacketProcessor contains all data required to correctly unwrap and forward sphinx packets
#[derive(Clone)]
pub struct PacketProcessor {
@@ -58,7 +57,7 @@ impl PacketProcessor {
metrics_reporter,
}
}
pub(crate) fn report_sent(&self, addr: SocketAddr) {
self.metrics_reporter.report_sent(addr.to_string())
}
@@ -72,13 +71,13 @@ impl PacketProcessor {
let next_hop_address =
addressing::socket_address_from_encoded_bytes(forward_address.to_bytes())?;
// TODO: change the calls after merge on sphinx PR
let delay_duration = Duration::from_nanos(delay.get_value());
// Delay packet for as long as required
tokio::time::delay_for(delay_duration).await;
tokio::time::delay_for(delay.to_duration()).await;
Ok(MixProcessingResult::ForwardHop(next_hop_address, packet.to_bytes()))
Ok(MixProcessingResult::ForwardHop(
next_hop_address,
packet.to_bytes(),
))
}
pub(crate) async fn process_sphinx_packet(