Add SszBlock test to check the canonical hash

This commit is contained in:
Paul Hauner 2018-09-20 13:56:44 +10:00
parent 2beeef8153
commit a4e61541aa
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -222,6 +222,15 @@ mod tests {
58, 145, 52, 47, 62, 158, 131, 46, 147
];
assert_eq!(hash, expected_hash);
/*
* Test if you give the SszBlock too many ssz bytes
*/
let mut too_long = serialized.clone();
too_long.push(42);
let ssz_block = SszBlock::from_slice(&too_long).unwrap();
let hash = ssz_block.block_hash();
assert_eq!(hash, expected_hash);
}
#[test]