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

core: use deterministic same-difficulty tie breaker #266

Merged
merged 1 commit into from
Sep 26, 2018
Merged

Conversation

jmank88
Copy link
Contributor

@jmank88 jmank88 commented Sep 25, 2018

When encountering two chain heads with the same block number and total difficulty, a random one would be chosen as canonical with a 50/50 chance. This could happen if a single node sends out two different versions of a block (with different txs), or it could be two arbitrary length competing branches. In either case, it's not clear who should win (either choice is valid). This PR proposes choosing the block with the most gas used, before falling back to randomization. In the length-1 case, the 'bigger' block is the obvious choice. In the arbitrary length case, the history would have to be inspected to make a more informed choice, but this method is no worse than the old. In both cases, all nodes on the chain will now make the same deterministic choice (when the gas used is different), reducing split decisions.

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.

1 participant