-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
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.
LGTM, tiny grumble.
let step = self.step.load(); | ||
let expected_diff = U256::from(U128::max_value()) + parent_step - step.into(); |
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.
Looks like the difficulty calcution is already copy pasted in couple of places, maybe we should extract it into a helper function?
let expected_diff = U256::from(U128::max_value()) + parent_step - step.into(); | ||
|
||
if header.difficulty() != &expected_diff { | ||
return Seal::None; |
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.
Would it make sense to seal and release a block with a previous step instead?
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 case can also only happen when update_sealing
is called upon import of new best block from the prior step, but update_sealing
also gets called when the step changes. So triggering sealing again for the correct step is unnecessary.
* Fix Aura difficulty race * fix test key * extract out score calculation * fix build
Previously this sequence of events was possible:
This might cause #6761 but will need further investigation.