-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Extract AppInitLoadBlockIndex from AppInitMain #13582
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
Conversation
8426636 to
e93569a
Compare
6bb58a2 to
c913c77
Compare
|
Both Windows builds failed with: |
c913c77 to
67ed865
Compare
|
Renamed |
|
utACK 67ed865. Nice refactor. Personally, I find the enum a bit heavy and think it would be simpler to return a bool and an additional if (fShutdownRequested) {
} else if (success) {
} else if (fReset || fatal_err) {
return InitError( );
} else {
} |
67ed865 to
fb28c7f
Compare
|
Thanks for the review @jimpo. I see what you mean - switched to a boolean return, and made |
|
utACK fb28c7f5cf903c0c21f823b2e179a39bd69c9549 Yes, I like this approach more. |
fb28c7f to
b3a01bd
Compare
|
Rebased for #13235 |
|
Needs rebase for #13577 |
b3a01bd to
463994c
Compare
|
Rebased for #13577 |
|
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. |
262a3f2 to
4c0ea2e
Compare
|
Switched to using function-try-block. If people aren't into that, maybe we should discourage them in the developer-notes? |
|
Travis failed with unrelated error, restarted. Regarding function-try-block I'm -0 if the reasoning is just to save one level of indentation in the function body. |
4c0ea2e to
a2dbe2a
Compare
|
Yeah, on second thought, switched back to regular try/catch. The framing of the function body and the consistent treatment help with the reading of the function IMO. |
|
utACK a2dbe2a. |
c665630 to
64f9c90
Compare
|
Rebased for #14437 |
|
Appveyor failure looks unrelated |
64f9c90 to
d1a0c39
Compare
|
Reworked to minimize |
d1a0c39 to
44c7789
Compare
|
Rebase for #15402 |
f37aeea to
6dd65f8
Compare
AppInitMain goes from ~650 lines to ~500. This also replaces constructs like `while(false)` and using `break` vs `return` with more explicit operation.
6dd65f8 to
c95a277
Compare
|
Rebased |
| // If the loaded chain has a wrong genesis, bail out immediately | ||
| // (we're likely using a testnet datadir, or the other way around). | ||
| if (!mapBlockIndex.empty() && !LookupBlockIndex(chainparams.GetConsensus().hashGenesisBlock)) { | ||
| fReset = true; // don't retry |
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.
was this added? I don't see it in the original block. not saying it's wrong, but just wondering.
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.
It's that way because there were 2 ways to exit the prior codeblock: break and return. This is special handling for the one return case.
| Needs rebase |
|
Closing as rebasing this is too much a chore. :P |
AppInitMain goes from ~650 lines to ~500. This also replaces constructs like
while(false)and usingbreakvsreturnwith a simple bool result for moreexplicit operation.
Prompted by looking into #13577
Suggest:
git diff --color-moved=dimmed_zebra --color-moved-ws=allow-indentation-change head^to aid review.