Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Caching for computing seed hashes (#541) #841

Merged
merged 1 commit into from
Mar 27, 2016

Conversation

peterjoel
Copy link
Contributor

No description provided.

@gavofyork gavofyork added A0-pleasereview 🤓 Pull request needs code review. A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Mar 27, 2016
@gavofyork
Copy link
Contributor

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>,
Copy link
Collaborator

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

Copy link
Contributor Author

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.

Copy link
Collaborator

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

Copy link
Collaborator

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.

@arkpar arkpar added A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. and removed A8-looksgood 🦄 Pull request is reviewed well. labels Mar 27, 2016

#[inline]
pub fn resume_compute_seedhash(mut hash: H256, start_epoch: u64, end_epoch: u64) -> H256 {
println!("COMPUTE {:?} {:?}", start_epoch, end_epoch);
Copy link
Contributor Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right

@gavofyork gavofyork added A8-looksgood 🦄 Pull request is reviewed well. and removed A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. labels Mar 27, 2016
@arkpar arkpar merged commit 2178f09 into openethereum:master Mar 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants