-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Caching for computing seed hashes (#541) #841
Conversation
lgtm - one more review pls. |
@@ -85,6 +86,7 @@ pub type H256 = [u8; 32]; | |||
pub struct Light { | |||
block_number: u64, | |||
cache: Vec<Node>, | |||
eth_compute: Mutex<EthCompute>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need a mutex here. Light
structures are already accessed in a synchronized way in EthashManager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a threadsafe, due to it's use by Ethash - because Engine
has a Sync
constraint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This structure is not a member of Engine
. It is managed by EthashManager
only. Adding Mutex to eth.rs is fine because Sync
is required there indeed. Light
does not to be Sync
though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the light struct in fact can be used out of the lock. Sorry for the confusion.
|
||
#[inline] | ||
pub fn resume_compute_seedhash(mut hash: H256, start_epoch: u64, end_epoch: u64) -> H256 { | ||
println!("COMPUTE {:?} {:?}", start_epoch, end_epoch); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably should remove this too. It was just for debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right
Code review changes
No description provided.