-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Globals: Remove a bunch of Params() from main.cpp before 0.12 #7053
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
utACK |
561fb7e
to
5aa4a0d
Compare
utACK |
@@ -3041,13 +3042,13 @@ void UnlinkPrunedFiles(std::set<int>& setFilesToPrune) | |||
} | |||
|
|||
/* Calculate the block/rev files that should be deleted to remain under target*/ | |||
void FindFilesToPrune(std::set<int>& setFilesToPrune) | |||
void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight) |
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.
Nit: I think it'd make more sense if FindFilesToPrune() took a params object, as the PruneAfterHeight feels like an implementation specific detail that FlushStateToDisk() doesn't need to know about.
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 seems to me that nPruneAfterHeight is precisely the only "implementation detail" from CChainParams that FlushStateToDisk() needs to know about.
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.
Right now it is, but my point is the fact that it is is an implementation detail that may change in the future!
But anyway, that's a pretty minor nit.
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.
I'm not sure it was a good idea to put nPruneAfterHeight in CChainParams in the first place. In any case, for functions that only take one thing from CChainParams (not Consensus::Params) I prefer to use the single thing directly instead of the full CChainParams, and if FlushStateToDisk ever needs more things from CChainParams, he can change the function prototype himself. See #6173 for example.
So I'm going to leave it as is and squash.
utACK |
1) Chainparams: Explicit CChainParams arg for main: -AcceptBlock -AcceptBlockHeader -ActivateBestChain -ConnectTip -InitBlockIndex -LoadExternalBlockFile -VerifyDB parametric constructor 2) Also pickup more Params()\. in main.cpp 3) Pass nPruneAfterHeight explicitly to new FindFilesToPrune() in main.cpp
5aa4a0d
to
2e29e7e
Compare
Squashed |
utACK |
2e29e7e Globals: Remove a bunch of Params() calls from main.cpp: (Jorge Timón)
Bitcoin Core refactoring and cleanups 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#5994 - bitcoin/bitcoin#6538 - bitcoin/bitcoin#6163 - bitcoin/bitcoin#6982 - bitcoin/bitcoin#6986 - bitcoin/bitcoin#7053 - bitcoin/bitcoin#7444 - bitcoin/bitcoin#7793 - Excluding some comments in `txmempool.h` on code we haven't yet pulled in. - bitcoin/bitcoin#7916 - bitcoin/bitcoin#7815 Additionally, the Equihash parameters are moved into the consensus parameters. Part of #2074.
Bitcoin Core refactoring and cleanups 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#5994 - bitcoin/bitcoin#6538 - bitcoin/bitcoin#6163 - bitcoin/bitcoin#6982 - bitcoin/bitcoin#6986 - bitcoin/bitcoin#7053 - bitcoin/bitcoin#7444 - bitcoin/bitcoin#7793 - Excluding some comments in `txmempool.h` on code we haven't yet pulled in. - bitcoin/bitcoin#7916 - bitcoin/bitcoin#7815 Additionally, the Equihash parameters are moved into the consensus parameters. Part of #2074.
Bitcoin Core refactoring and cleanups 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#5994 - bitcoin/bitcoin#6538 - bitcoin/bitcoin#6163 - bitcoin/bitcoin#6982 - bitcoin/bitcoin#6986 - bitcoin/bitcoin#7053 - bitcoin/bitcoin#7444 - bitcoin/bitcoin#7793 - Excluding some comments in `txmempool.h` on code we haven't yet pulled in. - bitcoin/bitcoin#7916 - bitcoin/bitcoin#7815 Additionally, the Equihash parameters are moved into the consensus parameters. Part of #2074.
Bitcoin Core refactoring and cleanups 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#5994 - bitcoin/bitcoin#6538 - bitcoin/bitcoin#6163 - bitcoin/bitcoin#6982 - bitcoin/bitcoin#6986 - bitcoin/bitcoin#7053 - bitcoin/bitcoin#7444 - bitcoin/bitcoin#7793 - Excluding some comments in `txmempool.h` on code we haven't yet pulled in. - bitcoin/bitcoin#7916 - bitcoin/bitcoin#7815 Additionally, the Equihash parameters are moved into the consensus parameters. Part of #2074.
Bitcoin Core refactoring and cleanups 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#5994 - bitcoin/bitcoin#6538 - bitcoin/bitcoin#6163 - bitcoin/bitcoin#6982 - bitcoin/bitcoin#6986 - bitcoin/bitcoin#7053 - bitcoin/bitcoin#7444 - bitcoin/bitcoin#7793 - Excluding some comments in `txmempool.h` on code we haven't yet pulled in. - bitcoin/bitcoin#7916 - bitcoin/bitcoin#7815 Additionally, the Equihash parameters are moved into the consensus parameters. Part of #2074.
Bitcoin Core refactoring and cleanups 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6538 - bitcoin/bitcoin#6163 - bitcoin/bitcoin#6982 - bitcoin/bitcoin#6986 - bitcoin/bitcoin#7053 - bitcoin/bitcoin#7444 - bitcoin/bitcoin#7793 - Excluding some comments in `txmempool.h` on code we haven't yet pulled in. - bitcoin/bitcoin#7916 - bitcoin/bitcoin#7815 Additionally, the Equihash parameters are moved into the consensus parameters, and various other functions in `main.cpp` have `const CChainParams&` arguments added. Part of #2074.
Bitcoin Core refactoring and cleanups 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6538 - bitcoin/bitcoin#6163 - bitcoin/bitcoin#6982 - bitcoin/bitcoin#6986 - bitcoin/bitcoin#7053 - bitcoin/bitcoin#7444 - bitcoin/bitcoin#7793 - Excluding some comments in `txmempool.h` on code we haven't yet pulled in. - bitcoin/bitcoin#7916 - bitcoin/bitcoin#7815 Additionally, the Equihash parameters are moved into the consensus parameters, and various other functions in `main.cpp` have `const CChainParams&` arguments added. Part of #2074.
Bitcoin Core refactoring and cleanups 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6538 - bitcoin/bitcoin#6163 - bitcoin/bitcoin#6982 - bitcoin/bitcoin#6986 - bitcoin/bitcoin#7053 - bitcoin/bitcoin#7444 - bitcoin/bitcoin#7793 - Excluding some comments in `txmempool.h` on code we haven't yet pulled in. - bitcoin/bitcoin#7916 - bitcoin/bitcoin#7815 Additionally, the Equihash parameters are moved into the consensus parameters, and various other functions in `main.cpp` have `const CChainParams&` arguments added. Part of #2074.
Bitcoin Core refactoring and cleanups 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6538 - bitcoin/bitcoin#6163 - bitcoin/bitcoin#6982 - bitcoin/bitcoin#6986 - bitcoin/bitcoin#7053 - bitcoin/bitcoin#7444 - bitcoin/bitcoin#7793 - Excluding some comments in `txmempool.h` on code we haven't yet pulled in. - bitcoin/bitcoin#7916 - bitcoin/bitcoin#7815 Additionally, the Equihash parameters are moved into the consensus parameters, and various other functions in `main.cpp` have `const CChainParams&` arguments added. Part of #2074.
This the last part of #5970 that is going to be opened independently,
see more details for why in #5970 (comment).
The main remaining commit in that #5970 was
jtimon@8550a27
which is lazily leveraging not only previous steps in that PR,
but also in the additional work by many people accepting that, given
that they were altering the declaration of a function, it was free
for them to pass Consensus::Params or CChainParams too. This PR
contains that commit plus a few small additions ready to squash or
leave out.
It may be disruptive to things we would really like to see in 0.12
before the testing window closes, but I can easily rebase this on
demand, even after all the desired changes are merged and right
before forking 0.12 (and I believe it will remain pretty reviewable and
low risk). It is likely that after rebase, this becomes more incomplete than it currently is, but better is better.