@@ -169,7 +169,7 @@ struct OnionNode {
169
169
/// Path used to send packets to this node.
170
170
path_id : OnionPathId ,
171
171
/// Ping id that should be used to announce to this node.
172
- ping_id : Option < sha256 :: Digest > ,
172
+ ping_id : Option < [ u8 ; 32 ] > ,
173
173
/// Data `PublicKey` that should be used to send data packets to our friend
174
174
/// through this node.
175
175
data_pk : Option < PublicKey > ,
@@ -268,7 +268,7 @@ struct AnnouncePacketData<'a> {
268
268
impl < ' a > AnnouncePacketData < ' a > {
269
269
/// Create `InnerOnionAnnounceRequest`. The request is a search request if
270
270
/// pind_id is 0 and an announce request otherwise.
271
- fn request ( & self , node_pk : & PublicKey , ping_id : Option < sha256 :: Digest > , request_id : u64 ) -> InnerOnionAnnounceRequest {
271
+ fn request ( & self , node_pk : & PublicKey , ping_id : Option < [ u8 ; 32 ] > , request_id : u64 ) -> InnerOnionAnnounceRequest {
272
272
let payload = OnionAnnounceRequestPayload {
273
273
ping_id : ping_id. unwrap_or ( INITIAL_PING_ID ) ,
274
274
search_pk : self . search_pk ,
@@ -286,7 +286,7 @@ impl<'a> AnnouncePacketData<'a> {
286
286
self . request ( node_pk, None , request_id)
287
287
}
288
288
/// Create `InnerOnionAnnounceRequest` for an announce request.
289
- pub fn announce_request ( & self , node_pk : & PublicKey , ping_id : sha256 :: Digest , request_id : u64 ) -> InnerOnionAnnounceRequest {
289
+ pub fn announce_request ( & self , node_pk : & PublicKey , ping_id : [ u8 ; 32 ] , request_id : u64 ) -> InnerOnionAnnounceRequest {
290
290
self . request ( node_pk, Some ( ping_id) , request_id)
291
291
}
292
292
}
@@ -469,7 +469,7 @@ impl OnionClient {
469
469
let ( ping_id, data_pk) = if payload. announce_status == AnnounceStatus :: Found {
470
470
( None , Some ( PublicKey ( payload. ping_id_or_pk ) ) )
471
471
} else {
472
- ( Some ( sha256 :: Digest ( payload. ping_id_or_pk ) ) , None )
472
+ ( Some ( payload. ping_id_or_pk ) , None )
473
473
} ;
474
474
475
475
let now = clock_now ( ) ;
@@ -1021,7 +1021,7 @@ mod tests {
1021
1021
keys : [ gen_keypair ( ) . 0 , gen_keypair ( ) . 0 , gen_keypair ( ) . 0 ] ,
1022
1022
path_type : OnionPathType :: Udp ,
1023
1023
} ;
1024
- let ping_id = sha256 :: hash ( & [ 1 , 2 , 3 ] ) ;
1024
+ let ping_id = [ 42 ; 32 ] ;
1025
1025
let data_pk = gen_keypair ( ) . 0 ;
1026
1026
let new_now = now + Duration :: from_secs ( 1 ) ;
1027
1027
let other_onion_node = OnionNode {
@@ -1228,7 +1228,7 @@ mod tests {
1228
1228
// The sender should be added to close nodes
1229
1229
let onion_node = state. announce_list . get_node ( & real_pk, & sender_pk) . unwrap ( ) ;
1230
1230
assert_eq ! ( onion_node. path_id, path. id( ) ) ;
1231
- assert_eq ! ( onion_node. ping_id, Some ( sha256 :: Digest ( ping_id) ) ) ;
1231
+ assert_eq ! ( onion_node. ping_id, Some ( ping_id) ) ;
1232
1232
assert_eq ! ( onion_node. data_pk, None ) ;
1233
1233
assert_eq ! ( onion_node. announce_status, AnnounceStatus :: Announced ) ;
1234
1234
@@ -1920,7 +1920,7 @@ mod tests {
1920
1920
state. paths_pool . path_nodes . put ( node) ;
1921
1921
}
1922
1922
1923
- let ping_id = sha256 :: hash ( & [ 1 , 2 , 3 ] ) ;
1923
+ let ping_id = [ 42 ; 32 ] ;
1924
1924
let now = Instant :: now ( ) ;
1925
1925
1926
1926
let mut nodes_key_by_addr = HashMap :: new ( ) ;
@@ -2064,7 +2064,7 @@ mod tests {
2064
2064
saddr,
2065
2065
path_id : path. id ( ) ,
2066
2066
// regardless of this ping_id search requests should contain 0
2067
- ping_id : Some ( sha256 :: hash ( & [ 1 , 2 , 3 ] ) ) ,
2067
+ ping_id : Some ( [ 42 ; 32 ] ) ,
2068
2068
data_pk : None ,
2069
2069
unsuccessful_pings : 0 ,
2070
2070
added_time : now,
0 commit comments