Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R4R] the miner module should propose block on a proper fork #355

Merged
merged 2 commits into from Aug 10, 2021

Conversation

unclezoro
Copy link
Collaborator

Description

add a description of your changes here...

Rationale

When there are multi forks of the same height, the miner module may give up the correct fork in the current implementation.

Example

For validator, the forks who has the same TD but:

  1. Has smaller block timestamp
  2. Is not produced by the current valdiator
    get more chance to be included in the canonical chain.

Changes

The recent sign validator will not try to propose a block anymore.

Preflight checks

  • build passed (make build)
  • tests passed (make test)
  • manual transaction test passed

Already reviewed by

...

Related issues

... reference related issue #'s here ...

for seen, recent := range snap.Recents {
if recent == p.val {
// Signer is among recents, only wait if the current block doesn't shift it out
if limit := uint64(len(snap.Validators)/2 + 1); number < limit || seen > number-limit {
Copy link
Contributor

Choose a reason for hiding this comment

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

please put the "limit := " expression before the if expression, it can make the 'if' expression more concise.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if {statement}; {condition} is a widely used grammar, I think it is concise enough for reviewers.

@unclezoro unclezoro merged commit 955c78b into master Aug 10, 2021
@unclezoro unclezoro mentioned this pull request Aug 11, 2021
3 tasks
@unclezoro unclezoro deleted the val_stuck_issue branch August 11, 2021 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants