Created
June 11, 2017 20:14
-
-
Save ssbb/7c7c514f41604b71cb7b314fedca4a22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn verify<'a>(env: NifEnv<'a>, args: &[NifTerm<'a>]) -> NifResult<NifTerm<'a>> { | |
let block_number: u64 = try!(args[0].decode()); | |
let header_hash: &'a str = try!(args[1].decode()); | |
let nonce: u64 = try!(args[2].decode()); | |
let ethash = EthashManager::new(); | |
let result = ethash.compute_light(block_number, get_bytes_ref(header_hash), nonce); | |
Ok((atoms::ok(), result).encode(env)) | |
} | |
fn get_bytes_ref(s: &str) -> &[u8; 32] { assert!(s.len() == 32); unsafe { &*(s.as_ptr() as *const [u8; 32]) }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment