-
Notifications
You must be signed in to change notification settings - Fork 114
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
Refactoring the public TD management #487
Conversation
In the previous setup on boot, we load the blockchain and that involves setting the total difficulty both privately and publically, with these changes what used to be |
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
try { |
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.
Formatting error
if (td == null) { | ||
// TODO: currently returning incorrect total difficulty | ||
parseRLP(); | ||
return new BigInteger(1, this.header.getDifficulty()); |
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 can be confusing (and was confusing before), we only used getCumulativeDifficulty()
previously to set difficulty for genesis, and it works out because at genesis cumulativeDiff == diff
. Perhaps we should just swap the genesis initialization code to getDifficulty()
and return either the cumulative diff (if it is set) or BigInteger.ZERO
if it is not.
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.
Otherwise we may end up in a situation where we retrieve a non-zero difficulty and we cannot be sure whether it is the difficulty
or totalDifficulty
@yulongaion available to review? |
…getDifficultyBI for initial TD setup
Description
Please include a brief summary of the change that this pull request proposes. Include any relevant motivation and context. List any dependencies required for this change.
Fixes Issue # .
Type of change
Insert x into the following checkboxes to confirm (eg. [x]):
Testing
Please describe the tests you used to validate this pull request. Provide any relevant details for test configurations as well as any instructions to reproduce these results.
Verification
Insert x into the following checkboxes to confirm (eg. [x]):