Skip to content

Merely require FnMut #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ pub fn make_dataset(dataset: &mut [u8], cache: &[u8]) {

/// "Main" function of Ethash, calculating the mix digest and result given the
/// header and nonce.
pub fn hashimoto<F: Fn(usize) -> H512>(
pub fn hashimoto<F: FnMut(usize) -> H512>(
header_hash: H256, nonce: H64, full_size: usize, lookup: F
) -> (H256, H256) {
hashimoto_with_hasher(
Expand All @@ -204,8 +204,8 @@ pub fn hashimoto<F: Fn(usize) -> H512>(
)
}

pub fn hashimoto_with_hasher<F: Fn(usize) -> H512, HF256: Fn(&[u8]) -> [u8; 32], HF512: Fn(&[u8]) -> [u8; 64]>(
header_hash: H256, nonce: H64, full_size: usize, lookup: F, hasher256: HF256, hasher512: HF512
pub fn hashimoto_with_hasher<F: FnMut(usize) -> H512, HF256: FnMut(&[u8]) -> [u8; 32], HF512: FnMut(&[u8]) -> [u8; 64]>(
header_hash: H256, nonce: H64, full_size: usize, mut lookup: F, mut hasher256: HF256, mut hasher512: HF512
) -> (H256, H256) {
let n = full_size / HASH_BYTES;
let w = MIX_BYTES / WORD_BYTES;
Expand Down