Skip to content

Commit 1eed2ad

Browse files
committed
f - use core::cmp::min/max
1 parent 94affbe commit 1eed2ad

File tree

1 file changed

+2
-7
lines changed
  • lightning/src/blinded_path

1 file changed

+2
-7
lines changed

lightning/src/blinded_path/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,9 @@ impl Direction {
259259

260260
/// Returns the [`PublicKey`] from the inputs corresponding to the direction.
261261
pub fn select_pubkey<'a>(&self, node_a: &'a PublicKey, node_b: &'a PublicKey) -> &'a PublicKey {
262-
let (node_one, node_two) = if node_a < node_b {
263-
(node_a, node_b)
264-
} else {
265-
(node_b, node_a)
266-
};
267262
match self {
268-
Direction::NodeOne => node_one,
269-
Direction::NodeTwo => node_two,
263+
Direction::NodeOne => core::cmp::min(node_a, node_b),
264+
Direction::NodeTwo => core::cmp::max(node_a, node_b)
270265
}
271266
}
272267
}

0 commit comments

Comments
 (0)