Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Clique: Prevent out of turn blocks interrupt in-turn mining #364

Merged
merged 5 commits into from
Dec 8, 2018

Conversation

rain-on
Copy link
Contributor

@rain-on rain-on commented Dec 5, 2018

It was identified the current mining operation should not be cancelled upon reception of a new chain head if said mining operation were targetting a higher total-difficulty.

The mining framework has been updated such that the difficulty of the new block is calcualted 'upfront' - and can be checked when a new block arrives.

@rain-on rain-on requested review from ajsutton and Errorific December 5, 2018 01:53
@rain-on rain-on changed the title Inject difficulty to miner Clique: Prevent out of turn blocks interrupt in-turn mining Dec 6, 2018

@Override
protected boolean importedBlockInvalidatesMiningOperation(final Block newBlock) {
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels a bit light on logic. The true works for the way the code is written in AbstractMiningCoordinator but feels like this should be looking at whether the imported block is on the same chain path as the current miner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

renamed function to highlight that this should be invoked on "newChainHead"

tmohay added 3 commits December 7, 2018 14:04
tmohay and others added 2 commits December 7, 2018 15:40
Tests are still written with a full blockchain - which is semi-useful.
@rain-on rain-on merged commit 08cc582 into PegaSysEng:master Dec 8, 2018
@rain-on rain-on deleted the diff_inject branch January 16, 2019 21:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants