MCPcopy Create free account
hub / github.com/BitVM/BitVM / test_hash_check_fail

Function test_hash_check_fail

header-chain/src/header_chain.rs:926–944  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

924 #[test]
925 #[should_panic(expected = "Hash is not valid")]
926 fn test_hash_check_fail() {
927 let block_headers = BLOCK_HEADERS
928 .iter()
929 .map(|header| CircuitBlockHeader::try_from_slice(header).unwrap())
930 .collect::<Vec<CircuitBlockHeader>>();
931
932 let first_15_hashes = block_headers[..15]
933 .iter()
934 .map(|header| header.compute_block_hash())
935 .collect::<Vec<[u8; 32]>>();
936
937 // The validation is expected to panic
938 check_hash_valid(
939 &first_15_hashes[0],
940 &U256::from_be_hex("00000000FFFF0000000000000000000000000000000000000000000000000000")
941 .wrapping_div(&(U256::ONE << 157))
942 .to_be_bytes(),
943 );
944 }
945
946 #[test]
947 fn test_hash_check_pass() {

Callers

nothing calls this directly

Calls 2

check_hash_validFunction · 0.85
compute_block_hashMethod · 0.80

Tested by

no test coverage detected