1
1
use crate :: provider:: storage:: StoreData ;
2
2
use crypto:: identity:: DummyMixIdentityPrivateKey ;
3
+ use log:: warn;
3
4
use sphinx:: { ProcessedPacket , SphinxPacket } ;
4
5
use std:: path:: PathBuf ;
5
6
use std:: sync:: { Arc , RwLock } ;
@@ -8,11 +9,12 @@ use std::sync::{Arc, RwLock};
8
9
// DUPLICATE WITH MIXNODE CODE!!!
9
10
#[ derive( Debug ) ]
10
11
pub enum MixProcessingError {
11
- SphinxRecoveryError ,
12
- ReceivedForwardHopError ,
12
+ FileIOFailure ,
13
13
InvalidPayload ,
14
14
NonMatchingRecipient ,
15
- FileIOFailure ,
15
+ ReceivedForwardHopError ,
16
+ SphinxRecoveryError ,
17
+ SphinxProcessingError ,
16
18
}
17
19
18
20
impl From < sphinx:: ProcessingError > for MixProcessingError {
@@ -63,10 +65,14 @@ impl MixPacketProcessor {
63
65
let read_processing_data = processing_data. read ( ) . unwrap ( ) ;
64
66
let ( client_address, client_surb_id, payload) =
65
67
match packet. process ( read_processing_data. secret_key . as_scalar ( ) ) {
66
- ProcessedPacket :: ProcessedPacketFinalHop ( client_address, surb_id, payload) => {
68
+ Ok ( ProcessedPacket :: ProcessedPacketFinalHop ( client_address, surb_id, payload) ) => {
67
69
( client_address, surb_id, payload)
68
70
}
69
- _ => return Err ( MixProcessingError :: ReceivedForwardHopError ) ,
71
+ Ok ( _) => return Err ( MixProcessingError :: ReceivedForwardHopError ) ,
72
+ Err ( e) => {
73
+ warn ! ( "Error unwrapping Sphinx packet: {:?}" , e) ;
74
+ return Err ( MixProcessingError :: SphinxProcessingError ) ;
75
+ }
70
76
} ;
71
77
72
78
// TODO: should provider try to be recovering plaintext? this would potentially make client retrieve messages of non-constant length,
0 commit comments