(hash: &[u8; 32], target_bytes: &[u8; 32])
| 343 | } |
| 344 | |
| 345 | fn check_hash_valid(hash: &[u8; 32], target_bytes: &[u8; 32]) { |
| 346 | for i in 0..32 { |
| 347 | if hash[31 - i] < target_bytes[i] { |
| 348 | return; |
| 349 | } else if hash[31 - i] > target_bytes[i] { |
| 350 | panic!("Hash is not valid"); |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | fn calculate_work(target: &[u8; 32]) -> U256 { |
| 356 | let target = U256::from_be_slice(target); |
no outgoing calls