File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -352,11 +352,7 @@ impl SphinxHeader {
352352 let shared_secret = PublicKey :: from ( shared_secret_bytes) ;
353353
354354 // the rest are for the encapsulated routing info
355- let encapsulated_routing_info_bytes = bytes[ 32 ..HEADER_SIZE ] . to_vec ( ) ;
356-
357- let routing_info = Box :: new ( EncapsulatedRoutingInformation :: from_bytes (
358- & encapsulated_routing_info_bytes,
359- ) ?) ;
355+ let routing_info = Box :: new ( EncapsulatedRoutingInformation :: from_bytes ( & bytes[ 32 ..] ) ?) ;
360356
361357 Ok ( SphinxHeader {
362358 shared_secret,
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ impl SURBMaterial {
9999 }
100100
101101 #[ allow( non_snake_case) ]
102- pub fn construct_legacy_SURB ( self ) -> Result < SURB > {
102+ pub fn construct_SURB ( self ) -> Result < SURB > {
103103 let surb_initial_secret = StaticSecret :: random ( ) ;
104104 SURB :: new ( surb_initial_secret, self )
105105 }
@@ -224,6 +224,21 @@ impl SURB {
224224 payload_keys_material,
225225 } )
226226 }
227+
228+ pub fn first_hop ( & self ) -> NodeAddressBytes {
229+ self . first_hop_address
230+ }
231+
232+ pub fn materials_count ( & self ) -> usize {
233+ match & self . payload_keys_material {
234+ PayloadKeysMaterial :: DerivedKeys ( keys) => keys. len ( ) ,
235+ PayloadKeysMaterial :: KeySeeds ( seeds) => seeds. len ( ) ,
236+ }
237+ }
238+
239+ pub fn uses_key_seeds ( & self ) -> bool {
240+ matches ! ( self . payload_keys_material, PayloadKeysMaterial :: KeySeeds ( _) )
241+ }
227242}
228243
229244#[ cfg( test) ]
You can’t perform that action at this time.
0 commit comments