File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -229,3 +229,17 @@ impl_writeable!(BlindedHop, {
229
229
encrypted_payload
230
230
} ) ;
231
231
232
+ impl Direction {
233
+ /// Returns the [`NodeId`] from the inputs corresponding to the direction.
234
+ pub fn select_node_id < ' a > ( & self , node_a : & ' a NodeId , node_b : & ' a NodeId ) -> & ' a NodeId {
235
+ let ( node_one, node_two) = if node_a < node_b {
236
+ ( node_a, node_b)
237
+ } else {
238
+ ( node_b, node_a)
239
+ } ;
240
+ match self {
241
+ Direction :: NodeOne => node_one,
242
+ Direction :: NodeTwo => node_two,
243
+ }
244
+ }
245
+ }
Original file line number Diff line number Diff line change @@ -2558,15 +2558,7 @@ where L::Target: Logger {
2558
2558
) ;
2559
2559
match first_hop {
2560
2560
Some ( ( counterparty_node_id, _) ) => {
2561
- let ( node_one, node_two) = if our_node_id < * counterparty_node_id {
2562
- ( & our_node_id, counterparty_node_id)
2563
- } else {
2564
- ( counterparty_node_id, & our_node_id)
2565
- } ;
2566
- match direction {
2567
- Direction :: NodeOne => node_one,
2568
- Direction :: NodeTwo => node_two,
2569
- }
2561
+ direction. select_node_id ( & our_node_id, counterparty_node_id)
2570
2562
} ,
2571
2563
None => continue ,
2572
2564
}
You can’t perform that action at this time.
0 commit comments