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

Function test_hash_check_pass

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

Source from the content-addressed store, hash-verified

945
946 #[test]
947 fn test_hash_check_pass() {
948 let block_headers = BLOCK_HEADERS
949 .iter()
950 .map(|header| CircuitBlockHeader::try_from_slice(header).unwrap())
951 .collect::<Vec<CircuitBlockHeader>>();
952
953 let first_15_hashes = block_headers[..15]
954 .iter()
955 .map(|header| header.compute_block_hash())
956 .collect::<Vec<[u8; 32]>>();
957
958 for (i, hash) in first_15_hashes.into_iter().enumerate() {
959 check_hash_valid(&hash, &bits_to_target(block_headers[i].bits));
960 }
961 }
962
963 #[test]
964 fn test_target_conversion() {

Callers

nothing calls this directly

Calls 3

check_hash_validFunction · 0.85
bits_to_targetFunction · 0.85
compute_block_hashMethod · 0.80

Tested by

no test coverage detected