@@ -136,9 +136,9 @@ fn two_unblinded_two_blinded() {
136
136
let test_msg = OnionMessageContents :: Custom ( TestCustomMessage { } ) ;
137
137
138
138
let secp_ctx = Secp256k1 :: new ( ) ;
139
- let blinded_route = BlindedPath :: new ( & [ nodes[ 3 ] . get_node_pk ( ) , nodes[ 4 ] . get_node_pk ( ) ] , & * nodes[ 4 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
139
+ let blinded_path = BlindedPath :: new ( & [ nodes[ 3 ] . get_node_pk ( ) , nodes[ 4 ] . get_node_pk ( ) ] , & * nodes[ 4 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
140
140
141
- nodes[ 0 ] . messenger . send_onion_message ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) ] , Destination :: BlindedPath ( blinded_route ) , test_msg, None ) . unwrap ( ) ;
141
+ nodes[ 0 ] . messenger . send_onion_message ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) ] , Destination :: BlindedPath ( blinded_path ) , test_msg, None ) . unwrap ( ) ;
142
142
pass_along_path ( & nodes, None ) ;
143
143
}
144
144
@@ -148,9 +148,9 @@ fn three_blinded_hops() {
148
148
let test_msg = OnionMessageContents :: Custom ( TestCustomMessage { } ) ;
149
149
150
150
let secp_ctx = Secp256k1 :: new ( ) ;
151
- let blinded_route = BlindedPath :: new ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) , nodes[ 3 ] . get_node_pk ( ) ] , & * nodes[ 3 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
151
+ let blinded_path = BlindedPath :: new ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) , nodes[ 3 ] . get_node_pk ( ) ] , & * nodes[ 3 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
152
152
153
- nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_route ) , test_msg, None ) . unwrap ( ) ;
153
+ nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_path ) , test_msg, None ) . unwrap ( ) ;
154
154
pass_along_path ( & nodes, None ) ;
155
155
}
156
156
@@ -174,36 +174,36 @@ fn we_are_intro_node() {
174
174
let test_msg = TestCustomMessage { } ;
175
175
176
176
let secp_ctx = Secp256k1 :: new ( ) ;
177
- let blinded_route = BlindedPath :: new ( & [ nodes[ 0 ] . get_node_pk ( ) , nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) ] , & * nodes[ 2 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
177
+ let blinded_path = BlindedPath :: new ( & [ nodes[ 0 ] . get_node_pk ( ) , nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) ] , & * nodes[ 2 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
178
178
179
- nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_route ) , OnionMessageContents :: Custom ( test_msg. clone ( ) ) , None ) . unwrap ( ) ;
179
+ nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_path ) , OnionMessageContents :: Custom ( test_msg. clone ( ) ) , None ) . unwrap ( ) ;
180
180
pass_along_path ( & nodes, None ) ;
181
181
182
182
// Try with a two-hop blinded route where we are the introduction node.
183
- let blinded_route = BlindedPath :: new ( & [ nodes[ 0 ] . get_node_pk ( ) , nodes[ 1 ] . get_node_pk ( ) ] , & * nodes[ 1 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
184
- nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_route ) , OnionMessageContents :: Custom ( test_msg) , None ) . unwrap ( ) ;
183
+ let blinded_path = BlindedPath :: new ( & [ nodes[ 0 ] . get_node_pk ( ) , nodes[ 1 ] . get_node_pk ( ) ] , & * nodes[ 1 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
184
+ nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_path ) , OnionMessageContents :: Custom ( test_msg) , None ) . unwrap ( ) ;
185
185
nodes. remove ( 2 ) ;
186
186
pass_along_path ( & nodes, None ) ;
187
187
}
188
188
189
189
#[ test]
190
- fn invalid_blinded_route_error ( ) {
190
+ fn invalid_blinded_path_error ( ) {
191
191
// Make sure we error as expected if a provided blinded route has 0 or 1 hops.
192
192
let nodes = create_nodes ( 3 ) ;
193
193
let test_msg = TestCustomMessage { } ;
194
194
195
195
// 0 hops
196
196
let secp_ctx = Secp256k1 :: new ( ) ;
197
- let mut blinded_route = BlindedPath :: new ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) ] , & * nodes[ 2 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
198
- blinded_route . blinded_hops . clear ( ) ;
199
- let err = nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_route ) , OnionMessageContents :: Custom ( test_msg. clone ( ) ) , None ) . unwrap_err ( ) ;
197
+ let mut blinded_path = BlindedPath :: new ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) ] , & * nodes[ 2 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
198
+ blinded_path . blinded_hops . clear ( ) ;
199
+ let err = nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_path ) , OnionMessageContents :: Custom ( test_msg. clone ( ) ) , None ) . unwrap_err ( ) ;
200
200
assert_eq ! ( err, SendError :: TooFewBlindedHops ) ;
201
201
202
202
// 1 hop
203
- let mut blinded_route = BlindedPath :: new ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) ] , & * nodes[ 2 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
204
- blinded_route . blinded_hops . remove ( 0 ) ;
205
- assert_eq ! ( blinded_route . blinded_hops. len( ) , 1 ) ;
206
- let err = nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_route ) , OnionMessageContents :: Custom ( test_msg) , None ) . unwrap_err ( ) ;
203
+ let mut blinded_path = BlindedPath :: new ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) ] , & * nodes[ 2 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
204
+ blinded_path . blinded_hops . remove ( 0 ) ;
205
+ assert_eq ! ( blinded_path . blinded_hops. len( ) , 1 ) ;
206
+ let err = nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_path ) , OnionMessageContents :: Custom ( test_msg) , None ) . unwrap_err ( ) ;
207
207
assert_eq ! ( err, SendError :: TooFewBlindedHops ) ;
208
208
}
209
209
@@ -223,10 +223,10 @@ fn reply_path() {
223
223
format ! ( "Received an onion message with path_id None and a reply_path" ) . to_string ( ) , 1 ) ;
224
224
225
225
// Destination::BlindedPath
226
- let blinded_route = BlindedPath :: new ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) , nodes[ 3 ] . get_node_pk ( ) ] , & * nodes[ 3 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
226
+ let blinded_path = BlindedPath :: new ( & [ nodes[ 1 ] . get_node_pk ( ) , nodes[ 2 ] . get_node_pk ( ) , nodes[ 3 ] . get_node_pk ( ) ] , & * nodes[ 3 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
227
227
let reply_path = BlindedPath :: new ( & [ nodes[ 2 ] . get_node_pk ( ) , nodes[ 1 ] . get_node_pk ( ) , nodes[ 0 ] . get_node_pk ( ) ] , & * nodes[ 0 ] . keys_manager , & secp_ctx) . unwrap ( ) ;
228
228
229
- nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_route ) , OnionMessageContents :: Custom ( test_msg) , Some ( reply_path) ) . unwrap ( ) ;
229
+ nodes[ 0 ] . messenger . send_onion_message ( & [ ] , Destination :: BlindedPath ( blinded_path ) , OnionMessageContents :: Custom ( test_msg) , Some ( reply_path) ) . unwrap ( ) ;
230
230
pass_along_path ( & nodes, None ) ;
231
231
nodes[ 3 ] . logger . assert_log_contains (
232
232
"lightning::onion_message::messenger" . to_string ( ) ,
0 commit comments