@@ -51,10 +51,8 @@ macro_rules! build_keys_helper {
51
51
hmac. input( encrypted_data_ss. as_ref( ) ) ;
52
52
Hmac :: from_engine( hmac) . to_byte_array( )
53
53
} ;
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" )
58
56
} ;
59
57
let onion_packet_ss = SharedSecret :: new( & blinded_hop_pk, & onion_packet_pubkey_priv) ;
60
58
@@ -84,9 +82,9 @@ macro_rules! build_keys_helper {
84
82
Sha256 :: from_engine( sha) . to_byte_array( )
85
83
} ;
86
84
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" ) ;
90
88
msg_blinding_point =
91
89
PublicKey :: from_secret_key( $secp_ctx, & msg_blinding_point_priv) ;
92
90
@@ -96,9 +94,9 @@ macro_rules! build_keys_helper {
96
94
sha. input( onion_packet_ss. as_ref( ) ) ;
97
95
Sha256 :: from_engine( sha) . to_byte_array( )
98
96
} ;
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" ) ;
102
100
onion_packet_pubkey =
103
101
PublicKey :: from_secret_key( $secp_ctx, & onion_packet_pubkey_priv) ;
104
102
} ;
@@ -109,8 +107,7 @@ macro_rules! build_keys_helper {
109
107
pub ( crate ) fn construct_keys_for_onion_message < ' a , T , I , F > (
110
108
secp_ctx : & Secp256k1 < T > , unblinded_path : I , destination : Destination , session_priv : & SecretKey ,
111
109
mut callback : F ,
112
- ) -> Result < ( ) , secp256k1:: Error >
113
- where
110
+ ) where
114
111
T : secp256k1:: Signing + secp256k1:: Verification ,
115
112
I : Iterator < Item = PublicKey > ,
116
113
F : FnMut ( SharedSecret , PublicKey , [ u8 ; 32 ] , Option < PublicKey > , Option < Vec < u8 > > ) ,
@@ -134,13 +131,11 @@ where
134
131
}
135
132
} ,
136
133
}
137
- Ok ( ( ) )
138
134
}
139
135
140
136
fn construct_keys_for_blinded_path < ' a , T , I , F , H > (
141
137
secp_ctx : & Secp256k1 < T > , unblinded_path : I , session_priv : & SecretKey , mut callback : F ,
142
- ) -> Result < ( ) , secp256k1:: Error >
143
- where
138
+ ) where
144
139
T : secp256k1:: Signing + secp256k1:: Verification ,
145
140
H : Borrow < PublicKey > ,
146
141
I : Iterator < Item = H > ,
@@ -151,7 +146,6 @@ where
151
146
for pk in unblinded_path {
152
147
build_keys_in_loop ! ( pk, false , None ) ;
153
148
}
154
- Ok ( ( ) )
155
149
}
156
150
157
151
struct PublicKeyWithTlvs < W : Writeable > {
@@ -168,7 +162,7 @@ impl<W: Writeable> Borrow<PublicKey> for PublicKeyWithTlvs<W> {
168
162
169
163
pub ( crate ) fn construct_blinded_hops < ' a , T , I , W > (
170
164
secp_ctx : & Secp256k1 < T > , unblinded_path : I , session_priv : & SecretKey ,
171
- ) -> Result < Vec < BlindedHop > , secp256k1 :: Error >
165
+ ) -> Vec < BlindedHop >
172
166
where
173
167
T : secp256k1:: Signing + secp256k1:: Verification ,
174
168
I : Iterator < Item = ( ( PublicKey , Option < ReceiveAuthKey > ) , W ) > ,
@@ -194,8 +188,8 @@ where
194
188
) ,
195
189
} ) ;
196
190
} ,
197
- ) ? ;
198
- Ok ( blinded_hops)
191
+ ) ;
192
+ blinded_hops
199
193
}
200
194
201
195
/// Encrypt TLV payload to be used as a [`crate::blinded_path::BlindedHop::encrypted_payload`].
0 commit comments