Fixed compilation errors due to changes in sphinx crate

This commit is contained in:
Jedrzej Stuczynski
2020-01-10 10:05:01 +00:00
parent cd28f8051b
commit 7068dc7089
4 changed files with 11 additions and 7 deletions
Generated
+1
View File
@@ -1798,6 +1798,7 @@ version = "0.1.0"
dependencies = [
"aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"chacha 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
+5 -3
View File
@@ -1,7 +1,7 @@
use crate::utils::bytes;
use addressing;
use curve25519_dalek::montgomery::MontgomeryPoint;
use sphinx::route::{Destination, DestinationAddressBytes, Node, SURBIdentifier};
use sphinx::route::{Destination, DestinationAddressBytes, Node, NodeAddressBytes, SURBIdentifier};
use sphinx::SphinxPacket;
use std::net::SocketAddr;
use topology::NymTopology;
@@ -32,7 +32,9 @@ pub fn encapsulate_message<T: NymTopology>(
let key = MontgomeryPoint(key_bytes);
let provider = Node::new(
addressing::encoded_bytes_from_socket_address(first_provider.mixnet_listener.clone()),
NodeAddressBytes::from_bytes(addressing::encoded_bytes_from_socket_address(
first_provider.mixnet_listener.clone(),
)),
key,
);
@@ -46,7 +48,7 @@ pub fn encapsulate_message<T: NymTopology>(
let packet = sphinx::SphinxPacket::new(message, &route[..], &recipient, &delays).unwrap();
let first_node_address =
addressing::socket_address_from_encoded_bytes(route.first().unwrap().address);
addressing::socket_address_from_encoded_bytes(route.first().unwrap().address.to_bytes());
(first_node_address, packet)
}
+2 -2
View File
@@ -1,7 +1,7 @@
use addressing;
use curve25519_dalek::montgomery::MontgomeryPoint;
use rand::seq::SliceRandom;
use sphinx::route::Node as SphinxNode;
use sphinx::route::{Node as SphinxNode, NodeAddressBytes};
use std::collections::HashMap;
use std::net::SocketAddr;
@@ -66,7 +66,7 @@ pub trait NymTopology {
key_bytes.copy_from_slice(&decoded_key_bytes[..]);
let key = MontgomeryPoint(key_bytes);
SphinxNode {
address: address_bytes,
address: NodeAddressBytes::from_bytes(address_bytes),
pub_key: key,
}
})
+3 -2
View File
@@ -1,4 +1,5 @@
use addressing;
use sphinx::route::NodeAddressBytes;
use std::error::Error;
use std::net::SocketAddr;
use tokio::prelude::*;
@@ -10,9 +11,9 @@ pub struct MixPeer {
impl MixPeer {
// note that very soon `next_hop_address` will be changed to `next_hop_metadata`
pub fn new(next_hop_address: [u8; 32]) -> MixPeer {
pub fn new(next_hop_address: NodeAddressBytes) -> MixPeer {
let next_hop_socket_address =
addressing::socket_address_from_encoded_bytes(next_hop_address);
addressing::socket_address_from_encoded_bytes(next_hop_address.to_bytes());
MixPeer {
connection: next_hop_socket_address,
}