Skip to content
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

Deterministic historian/accountant hashes #58

Merged
merged 1 commit into from
Mar 9, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "silk"
description = "A silky smooth implementation of the Loom architecture"
version = "0.3.2"
version = "0.3.3"
documentation = "https://docs.rs/silk"
homepage = "http://loomprotocol.com/"
repository = "https://github.com/loomprotocol/silk"
Expand Down
10 changes: 8 additions & 2 deletions src/historian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ impl Historian {
if let Err(err) = logger.process_events(now, ms_per_tick) {
return err;
}
logger.last_id = hash(&logger.last_id);
logger.num_hashes += 1;
if ms_per_tick.is_some() {
logger.last_id = hash(&logger.last_id);
logger.num_hashes += 1;
}
}
})
}
Expand Down Expand Up @@ -86,6 +88,10 @@ mod tests {
let entry1 = hist.receiver.recv().unwrap();
let entry2 = hist.receiver.recv().unwrap();

assert_eq!(entry0.num_hashes, 0);
assert_eq!(entry1.num_hashes, 0);
assert_eq!(entry2.num_hashes, 0);

drop(hist.sender);
assert_eq!(
hist.thread_hdl.join().unwrap(),
Expand Down