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

Disable preparing work package if miners don't ask for it. #771

Merged
merged 6 commits into from Mar 20, 2016

Conversation

tomusdrw
Copy link
Collaborator

Currently we start preparing new block for sealing (after chain head changes) only if miner will ask for work package (i.e. sealing_block method is called). After that we will be preparing new blocks indefinitely even though no one is expecting us to do so.

This PR introduces "block timeout". After SEALING_TIMEOUT_IN_BLOCKS (constant) blocks without being asked for sealing_block we stop producing new blocks (sealing_enabled is flipped)

@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. and removed A0-pleasereview 🤓 Pull request needs code review. labels Mar 18, 2016
Tomasz Drwięga added 2 commits March 18, 2016 19:36
Conflicts:
	ethcore/src/client/test_client.rs
	miner/src/miner.rs
@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. and removed A3-inprogress ⏳ Pull request is in progress. No review needed at this stage. labels Mar 18, 2016
@gavofyork
Copy link
Contributor

needs resolving.

@gavofyork
Copy link
Contributor

also, would be good to include a bit of text here to describe the changes (in particular what state is added).

Conflicts:
	miner/src/miner.rs
let current_no = chain.chain_info().best_block_number;
let last_request = self.sealing_block_last_request.lock().unwrap();

current_no - *last_request > SEALING_TIMEOUT_IN_BLOCKS
Copy link
Contributor

Choose a reason for hiding this comment

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

current_no can theoretically go down over time (e.g. a shorter fork with higher total difficulty)

@gavofyork gavofyork added A8-looksgood 🦄 Pull request is reviewed well. A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. and removed A0-pleasereview 🤓 Pull request needs code review. A8-looksgood 🦄 Pull request is reviewed well. labels Mar 19, 2016
@gavofyork
Copy link
Contributor

looks good otherwise.

@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. and removed A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. labels Mar 20, 2016
gavofyork added a commit that referenced this pull request Mar 20, 2016
Disable preparing work package if miners don't ask for it.
@gavofyork gavofyork merged commit dcb23de into master Mar 20, 2016
@gavofyork gavofyork deleted the tx_queue_timeout branch March 20, 2016 15:29
@arkpar arkpar added this to the 1.0 Parity milestone Mar 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-pleasereview 🤓 Pull request needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants