mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-20 05:16:35 +00:00
secio: don't panic in agree_ephemeral
. (#480)
Given that echoing back our local key and nonce would result in equal digest values, we should treat this as an error instead of panicking.
This commit is contained in:
@ -499,7 +499,10 @@ where
|
||||
let (local_infos, remote_infos) = {
|
||||
let (first_half, second_half) = longer_key.split_at(longer_key.len() / 2);
|
||||
match context.hashes_ordering {
|
||||
Ordering::Equal => panic!(),
|
||||
Ordering::Equal => {
|
||||
let msg = "equal digest of public key and nonce for local and remote";
|
||||
return Err(SecioError::InvalidProposition(msg))
|
||||
}
|
||||
Ordering::Less => (second_half, first_half),
|
||||
Ordering::Greater => (first_half, second_half),
|
||||
}
|
||||
|
Reference in New Issue
Block a user