Redundant code in mix handling

This commit is contained in:
Jedrzej Stuczynski
2020-03-03 12:44:37 +00:00
parent c167aca3e3
commit ff4284a3b9
2 changed files with 12 additions and 8 deletions
@@ -1,9 +1,2 @@
use crate::provider::storage::StoreData;
use crypto::encryption;
use log::{error, warn};
use sphinx::{ProcessedPacket, SphinxPacket};
use std::path::PathBuf;
use std::sync::{Arc, RwLock};
pub(crate) mod listener;
pub(crate) mod packet_processing;
@@ -1,7 +1,10 @@
use crate::provider::storage::{ClientStorage, StoreData};
use crypto::encryption;
use log::*;
use sphinx::payload::Payload;
use sphinx::route::{DestinationAddressBytes, SURBIdentifier};
use sphinx::{ProcessedPacket, SphinxPacket};
use std::io;
use std::ops::Deref;
use std::sync::Arc;
@@ -11,7 +14,7 @@ pub enum MixProcessingError {
NonMatchingRecipient,
InvalidPayload,
SphinxProcessingError,
InvalidHopAddress,
IOError(String),
}
pub enum MixProcessingResult {
@@ -29,6 +32,14 @@ impl From<sphinx::ProcessingError> for MixProcessingError {
}
}
impl From<io::Error> for MixProcessingError {
fn from(e: io::Error) -> Self {
use MixProcessingError::*;
IOError(e.to_string())
}
}
// PacketProcessor contains all data required to correctly unwrap and store sphinx packets
#[derive(Clone)]
pub struct PacketProcessor {