-
Notifications
You must be signed in to change notification settings - Fork 38.6k
pass Consensus::Params& to functions in validation.cpp and make them static #10201
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
pass Consensus::Params& to functions in validation.cpp and make them static #10201
Conversation
|
utACK. Want to mark ReceivedBlockTransactions static while you're at it? |
|
@TheBlueMatt sure. Should I soft reset the commit and add the new change within a single commit? |
|
Doesnt matter either way, I think. |
5fbaec1 to
25660e9
Compare
|
ACK 25660e9 |
|
ACK 25660e9 EDIT: or maybe a separated PR for that makes more sense, I'm not sure |
|
@jtimon this was the first time I was looking at a C++ code so my understanding of the language is next to zero. However, the similar pattern all the static functions seem to have is that they're only called within the same file. If that's the case (?) then I'll be able to do it (perhaps in a separate PR as you suggested). |
|
Yes, static functions are only called from the same file. So for searching more functions in validation.cpp that could be static, it's more about grep than about C++ (and as said feel free to copy from #10227 ). |
25660e9 pass Consensus::Params& to ReceivedBlockTransactions() (Mario Dian) Tree-SHA512: d3a5b19d93313e4bda622b322bc9cbfb7e31486010eac40fca6eea9703f814f9667f778122ba7366bb304482a2c03e2e3325083beecac374751692361952e467
|
Yeah, it seems OpenDiskFile and OpenUndoFile are only called from validation.cpp and can be static too. EDIT: also it seems @laanwj added one commit here by mistake. |
src/validation.h
Outdated
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.
The documentation you are removing from here, you could move to the cpp with the function definition
src/validation.cpp
Outdated
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.
Given that nManualPruneHeight is optional, the new CChainParams parameter (which is not) should come before it, for example, CChainParams can be the first parameter.
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
8bc88d9 to
a0a57e1
Compare
|
@jtimon oh, I "accidentally" soft reset my first commit instead of fixingup the last one so everything is in the single commit now. Sorry, I haven't worked with git for quite a long time. |
|
Mhmm, squashing in one commit is fine, what I mean is you also added a commit that doesn't belong here: |
8b23dfd to
a0a57e1
Compare
|
Needs rebase. EDIT: Also, perhaps changing the tittle name now that it does more things? |
|
@jtimon I changed the title. Before I break anything while rebasing, is the following all that is needed? Thank you. |
|
what I would usually do: Instead of jtimon, you need to use something else pointing to you repository Using -i (for interactive) it's not very useful in this case because it is only one commit and the rebase will stop in it for the conflict anyway, but you can try to replace s/pick/edit/ or s/pick/reword/ to experiment with it. You can also use it for squash commits or remove them, I use interactive rebase all the time. |
a0a57e1 to
cf8243b
Compare
|
Needs rebase |
af8be93 to
1dfdd81
Compare
d5eba1b to
1fe4f4c
Compare
|
needs rebase again |
1fe4f4c to
aba9780
Compare
src/validation.cpp
Outdated
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.
static bool iso bool static would be more consistent with other uses of static in the code
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 agree. Changed it.
Fix bugs as per PR comment Change bool static to static bool
aba9780 to
24980a3
Compare
…and make them static 24980a3 Make functions in validation.cpp static and pass chainparams (Mario Dian) Tree-SHA512: 2d1b7b0ffd851317ed522911c1b6592855376c5cbc65d71ec0f8aa507eb6caef21b0709b3692255f1d719662db7447579c10df02f6ef4cd35fcb0bdf2e653af6
…on.cpp and make them static 24980a3 Make functions in validation.cpp static and pass chainparams (Mario Dian) Tree-SHA512: 2d1b7b0ffd851317ed522911c1b6592855376c5cbc65d71ec0f8aa507eb6caef21b0709b3692255f1d719662db7447579c10df02f6ef4cd35fcb0bdf2e653af6 fix Signed-off-by: Pasta <[email protected]> add param Signed-off-by: Pasta <[email protected]>
Pass Consensus::Params& to ReceivedBlockTransactions() as requested in #7829