-
Notifications
You must be signed in to change notification settings - Fork 38.7k
refactor: Replace struct update_lock_points with lambda
#23958
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
This change makes code concise and improves it readability.
|
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. |
glozow
left a comment
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.
Concept ACK
It seems like these structs were introduced (5add7a7) before the codebase required a C++11 compiler (67969af), so no lambdas.
Since we're doing this here, I think it makes sense to modernize the other ones too:
Lines 26 to 65 in 807169e
| struct update_descendant_state | |
| { | |
| update_descendant_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount) : | |
| modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount) | |
| {} | |
| void operator() (CTxMemPoolEntry &e) | |
| { e.UpdateDescendantState(modifySize, modifyFee, modifyCount); } | |
| private: | |
| int64_t modifySize; | |
| CAmount modifyFee; | |
| int64_t modifyCount; | |
| }; | |
| struct update_ancestor_state | |
| { | |
| update_ancestor_state(int64_t _modifySize, CAmount _modifyFee, int64_t _modifyCount, int64_t _modifySigOpsCost) : | |
| modifySize(_modifySize), modifyFee(_modifyFee), modifyCount(_modifyCount), modifySigOpsCost(_modifySigOpsCost) | |
| {} | |
| void operator() (CTxMemPoolEntry &e) | |
| { e.UpdateAncestorState(modifySize, modifyFee, modifyCount, modifySigOpsCost); } | |
| private: | |
| int64_t modifySize; | |
| CAmount modifyFee; | |
| int64_t modifyCount; | |
| int64_t modifySigOpsCost; | |
| }; | |
| struct update_fee_delta | |
| { | |
| explicit update_fee_delta(int64_t _feeDelta) : feeDelta(_feeDelta) { } | |
| void operator() (CTxMemPoolEntry &e) { e.UpdateFeeDelta(feeDelta); } | |
| private: | |
| int64_t feeDelta; | |
| }; |
|
Closing in favor of #23976. |
This change makes code concise and improves it readability.