File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -949,16 +949,16 @@ where
949949 _ => unreachable ! ( ) ,
950950 } ;
951951
952- let ( outer_session_priv , inner_session_priv ) = if path. has_trampoline_hops ( ) {
952+ let secondary_session_priv = path. has_trampoline_hops ( ) . then ( || {
953953 // If we have Trampoline hops, the outer onion session_priv is a hash of the inner one.
954954 let session_priv_hash = Sha256 :: hash ( & primary_session_priv. secret_bytes ( ) ) . to_byte_array ( ) ;
955- (
956- & SecretKey :: from_slice ( & session_priv_hash [ .. ] ) . expect ( "You broke SHA-256!" ) ,
957- Some ( primary_session_priv ) ,
958- )
959- } else {
960- ( primary_session_priv , None )
961- } ;
955+ SecretKey :: from_slice ( & session_priv_hash [ .. ] ) . expect ( "You broke SHA-256!" )
956+ } ) ;
957+
958+ // the outer onion's session priv is the secondary (if it's set), or the primary as its fallback
959+ let outer_session_priv = secondary_session_priv . as_ref ( ) . unwrap_or ( primary_session_priv ) ;
960+ // the inner onion's session priv is only set if there is a secondary
961+ let inner_session_priv = secondary_session_priv . as_ref ( ) . map ( |_| primary_session_priv ) ;
962962
963963 process_onion_failure_inner (
964964 secp_ctx,
You can’t perform that action at this time.
0 commit comments