Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 17926ff

Browse files
authored
Merge pull request #58 from garious/deterministic-historian
Deterministic historian/accountant hashes
2 parents 8d17aed + 957fb06 commit 17926ff

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "silk"
33
description = "A silky smooth implementation of the Loom architecture"
4-
version = "0.3.2"
4+
version = "0.3.3"
55
documentation = "https://docs.rs/silk"
66
homepage = "http://loomprotocol.com/"
77
repository = "https://github.com/loomprotocol/silk"

src/historian.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ impl Historian {
4848
if let Err(err) = logger.process_events(now, ms_per_tick) {
4949
return err;
5050
}
51-
logger.last_id = hash(&logger.last_id);
52-
logger.num_hashes += 1;
51+
if ms_per_tick.is_some() {
52+
logger.last_id = hash(&logger.last_id);
53+
logger.num_hashes += 1;
54+
}
5355
}
5456
})
5557
}
@@ -86,6 +88,10 @@ mod tests {
8688
let entry1 = hist.receiver.recv().unwrap();
8789
let entry2 = hist.receiver.recv().unwrap();
8890

91+
assert_eq!(entry0.num_hashes, 0);
92+
assert_eq!(entry1.num_hashes, 0);
93+
assert_eq!(entry2.num_hashes, 0);
94+
8995
drop(hist.sender);
9096
assert_eq!(
9197
hist.thread_hdl.join().unwrap(),

0 commit comments

Comments
 (0)