Merge pull request #58 from garious/deterministic-historian
Deterministic historian/accountant hashes
This commit is contained in:
commit
17926ff5d9
|
@ -355,7 +355,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "silk"
|
name = "silk"
|
||||||
version = "0.3.2"
|
version = "0.3.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "silk"
|
name = "silk"
|
||||||
description = "A silky smooth implementation of the Loom architecture"
|
description = "A silky smooth implementation of the Loom architecture"
|
||||||
version = "0.3.2"
|
version = "0.3.3"
|
||||||
documentation = "https://docs.rs/silk"
|
documentation = "https://docs.rs/silk"
|
||||||
homepage = "http://loomprotocol.com/"
|
homepage = "http://loomprotocol.com/"
|
||||||
repository = "https://github.com/loomprotocol/silk"
|
repository = "https://github.com/loomprotocol/silk"
|
||||||
|
|
|
@ -48,8 +48,10 @@ impl Historian {
|
||||||
if let Err(err) = logger.process_events(now, ms_per_tick) {
|
if let Err(err) = logger.process_events(now, ms_per_tick) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
logger.last_id = hash(&logger.last_id);
|
if ms_per_tick.is_some() {
|
||||||
logger.num_hashes += 1;
|
logger.last_id = hash(&logger.last_id);
|
||||||
|
logger.num_hashes += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -86,6 +88,10 @@ mod tests {
|
||||||
let entry1 = hist.receiver.recv().unwrap();
|
let entry1 = hist.receiver.recv().unwrap();
|
||||||
let entry2 = 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);
|
drop(hist.sender);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
hist.thread_hdl.join().unwrap(),
|
hist.thread_hdl.join().unwrap(),
|
||||||
|
|
Loading…
Reference in New Issue