@@ -51,10 +51,8 @@ macro_rules! build_keys_helper {
5151 hmac. input( encrypted_data_ss. as_ref( ) ) ;
5252 Hmac :: from_engine( hmac) . to_byte_array( )
5353 } ;
54- pk. mul_tweak(
55- $secp_ctx,
56- & Scalar :: from_be_bytes( hop_pk_blinding_factor) . unwrap( ) ,
57- ) ?
54+ pk. mul_tweak( $secp_ctx, & Scalar :: from_be_bytes( hop_pk_blinding_factor) . unwrap( ) )
55+ . expect( "RNG is busted" )
5856 } ;
5957 let onion_packet_ss = SharedSecret :: new( & blinded_hop_pk, & onion_packet_pubkey_priv) ;
6058
@@ -84,9 +82,9 @@ macro_rules! build_keys_helper {
8482 Sha256 :: from_engine( sha) . to_byte_array( )
8583 } ;
8684
87- msg_blinding_point_priv = msg_blinding_point_priv. mul_tweak (
88- & Scalar :: from_be_bytes( msg_blinding_point_blinding_factor) . unwrap( ) ,
89- ) ? ;
85+ msg_blinding_point_priv = msg_blinding_point_priv
86+ . mul_tweak ( & Scalar :: from_be_bytes( msg_blinding_point_blinding_factor) . unwrap( ) )
87+ . expect ( "RNG is busted" ) ;
9088 msg_blinding_point =
9189 PublicKey :: from_secret_key( $secp_ctx, & msg_blinding_point_priv) ;
9290
@@ -96,9 +94,9 @@ macro_rules! build_keys_helper {
9694 sha. input( onion_packet_ss. as_ref( ) ) ;
9795 Sha256 :: from_engine( sha) . to_byte_array( )
9896 } ;
99- onion_packet_pubkey_priv = onion_packet_pubkey_priv. mul_tweak (
100- & Scalar :: from_be_bytes( onion_packet_pubkey_blinding_factor) . unwrap( ) ,
101- ) ? ;
97+ onion_packet_pubkey_priv = onion_packet_pubkey_priv
98+ . mul_tweak ( & Scalar :: from_be_bytes( onion_packet_pubkey_blinding_factor) . unwrap( ) )
99+ . expect ( "RNG is busted" ) ;
102100 onion_packet_pubkey =
103101 PublicKey :: from_secret_key( $secp_ctx, & onion_packet_pubkey_priv) ;
104102 } ;
@@ -109,8 +107,7 @@ macro_rules! build_keys_helper {
109107pub ( crate ) fn construct_keys_for_onion_message < ' a , T , I , F > (
110108 secp_ctx : & Secp256k1 < T > , unblinded_path : I , destination : Destination , session_priv : & SecretKey ,
111109 mut callback : F ,
112- ) -> Result < ( ) , secp256k1:: Error >
113- where
110+ ) where
114111 T : secp256k1:: Signing + secp256k1:: Verification ,
115112 I : Iterator < Item = PublicKey > ,
116113 F : FnMut ( SharedSecret , PublicKey , [ u8 ; 32 ] , Option < PublicKey > , Option < Vec < u8 > > ) ,
@@ -134,13 +131,11 @@ where
134131 }
135132 } ,
136133 }
137- Ok ( ( ) )
138134}
139135
140136fn construct_keys_for_blinded_path < ' a , T , I , F , H > (
141137 secp_ctx : & Secp256k1 < T > , unblinded_path : I , session_priv : & SecretKey , mut callback : F ,
142- ) -> Result < ( ) , secp256k1:: Error >
143- where
138+ ) where
144139 T : secp256k1:: Signing + secp256k1:: Verification ,
145140 H : Borrow < PublicKey > ,
146141 I : Iterator < Item = H > ,
@@ -151,7 +146,6 @@ where
151146 for pk in unblinded_path {
152147 build_keys_in_loop ! ( pk, false , None ) ;
153148 }
154- Ok ( ( ) )
155149}
156150
157151struct PublicKeyWithTlvs < W : Writeable > {
@@ -168,7 +162,7 @@ impl<W: Writeable> Borrow<PublicKey> for PublicKeyWithTlvs<W> {
168162
169163pub ( crate ) fn construct_blinded_hops < ' a , T , I , W > (
170164 secp_ctx : & Secp256k1 < T > , unblinded_path : I , session_priv : & SecretKey ,
171- ) -> Result < Vec < BlindedHop > , secp256k1 :: Error >
165+ ) -> Vec < BlindedHop >
172166where
173167 T : secp256k1:: Signing + secp256k1:: Verification ,
174168 I : Iterator < Item = ( ( PublicKey , Option < ReceiveAuthKey > ) , W ) > ,
@@ -194,8 +188,8 @@ where
194188 ) ,
195189 } ) ;
196190 } ,
197- ) ? ;
198- Ok ( blinded_hops)
191+ ) ;
192+ blinded_hops
199193}
200194
201195/// Encrypt TLV payload to be used as a [`crate::blinded_path::BlindedHop::encrypted_payload`].
0 commit comments