help: Generate checkpoint height from chainparams#19241
Merged
Conversation
Member
Contributor
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Member
Author
|
Abstracted checkpoint access and rebased |
6ba3f6d to
40ef5d4
Compare
Member
|
utACK 40ef5d4100c575db35fa736857d41a7c0c7df6de |
Contributor
|
utACK 40ef5d4 |
maflcko
suggested changes
Aug 20, 2020
40ef5d4 to
916d359
Compare
This was referenced Sep 3, 2020
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Sep 15, 2020
916d359 help: Generate checkpoint height from chainparams (Luke Dashjr) Pull request description: Not sure if this is worth putting in Core, but might as well until checkpoints are removed entirely. ACKs for top commit: laanwj: re-ACK 916d359 Tree-SHA512: d8eb26b570ee730fdd75ca916507134db5f2f68987a911e33544b7f1c9ccfd1c76b9c9db63056971956b6daf16910f17ecfc197481c2f7b0773afdfbf7d381cf
jnewbery
reviewed
Sep 15, 2020
|
|
||
| int GetHeight() const { | ||
| const auto& final_checkpoint = mapCheckpoints.rbegin(); | ||
| return final_checkpoint->first /* height */; |
Contributor
There was a problem hiding this comment.
I think ideally, any begin/end/rbegin/rend iterator should be tested before deferencing:
return final_checkpoint == mapCheckpoints.rend() ? 0 : final_checkpoint->first;or similar.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not sure if this is worth putting in Core, but might as well until checkpoints are removed entirely.