|
|
|
@ -38,7 +38,20 @@ mod tests {
|
|
|
|
|
let msg = Message::new( |
|
|
|
|
MsgType::MultiCast, Vec::<u8>::new(), &KeyPack::gen() |
|
|
|
|
); |
|
|
|
|
assert!(msg.verify()); |
|
|
|
|
assert!(&msg.verify()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|
fn test_invalid_sign() { |
|
|
|
|
let key_pack = KeyPack::gen(); |
|
|
|
|
let mut msg = Message::new( |
|
|
|
|
MsgType::MultiCast, Vec::<u8>::new(), &key_pack |
|
|
|
|
); |
|
|
|
|
msg.sign = [0;64].to_vec(); |
|
|
|
|
assert!(!&msg.verify()); |
|
|
|
|
msg.hash = [0;64].to_vec(); |
|
|
|
|
msg.sign = key_pack.sign(&msg); |
|
|
|
|
assert!(!&msg.verify()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#[test] |
|
|
|
|