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
mempool clean up: replace update_* structs with lambdas #26048
Conversation
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.
Just trying to help out here. I pulled it down and it built fine of course. But I don't really have anything to really run to hit the code path. I assume that the tests that are already available do so.
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. |
These were introduced in commit 5add7a7, when the codebase was pre-C++11. They are no longer necessary.
a02af7c
to
1b348d2
Compare
@amovfx probably the best way to review this PR is to review the code manually and check that no behavior has changed. If you want to run a quick smoke test (would show if something is really wrong in mempool entry accounting), I often use |
Thanks! Ill do this. I did this and everything is working, I tried running the test thats getting caught on the check for 32-bit + dash [gui] [CentOS 8], "wallet_reorgsrestore.py" and my test passed fine on macOS. I imagine I should be trying to test that in a docker container? |
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.
ACK 1b348d2
review ACK 1b348d2 👮 Show signatureSignature:
|
@@ -146,7 +114,9 @@ void CTxMemPool::UpdateForDescendants(txiter updateIt, cacheMap& cachedDescendan | |||
modifyCount++; | |||
cachedDescendants[updateIt].insert(mapTx.iterator_to(descendant)); | |||
// Update ancestor state for each descendant | |||
mapTx.modify(mapTx.iterator_to(descendant), update_ancestor_state(updateIt->GetTxSize(), updateIt->GetModifiedFee(), 1, updateIt->GetSigOpCost())); | |||
mapTx.modify(mapTx.iterator_to(descendant), [=](CTxMemPoolEntry& e) { | |||
e.UpdateAncestorState(updateIt->GetTxSize(), updateIt->GetModifiedFee(), 1, updateIt->GetSigOpCost()); |
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.
e.UpdateAncestorState(updateIt->GetTxSize(), updateIt->GetModifiedFee(), 1, updateIt->GetSigOpCost()); | |
e.UpdateAncestorState(updateIt->GetTxSize(), updateIt->GetModifiedFee(), /*modifyCount=*/1, updateIt->GetSigOpCost()); |
@@ -393,7 +363,7 @@ void CTxMemPool::UpdateForRemoveFromMempool(const setEntries &entriesToRemove, b | |||
CAmount modifyFee = -removeIt->GetModifiedFee(); | |||
int modifySigOps = -removeIt->GetSigOpCost(); | |||
for (txiter dit : setDescendants) { | |||
mapTx.modify(dit, update_ancestor_state(modifySize, modifyFee, -1, modifySigOps)); | |||
mapTx.modify(dit, [=](CTxMemPoolEntry& e){ e.UpdateAncestorState(modifySize, modifyFee, -1, modifySigOps); }); |
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.
mapTx.modify(dit, [=](CTxMemPoolEntry& e){ e.UpdateAncestorState(modifySize, modifyFee, -1, modifySigOps); }); | |
mapTx.modify(dit, [=](CTxMemPoolEntry& e) { e.UpdateAncestorState(modifySize, modifyFee, /*modifyCount=*/-1, modifySigOps); }); |
…lambdas 1b348d2 [mempool] replace update_descendant_state with lambda (glozow) Pull request description: These were introduced in commit bitcoin@5add7a7, when the codebase was pre-C++11. We can use lambdas now. ACKs for top commit: MarcoFalke: review ACK 1b348d2 👮 w0xlt: ACK bitcoin@1b348d2 Tree-SHA512: b664425b395e39ecf1cfc1e731200378261cf58c3985075fdc6027731a5caf995de72ea25be99b4c0dbec2e3ee6cf940e7c577638844619c66c8494ead5da459
These were introduced in commit 5add7a7, when the codebase was pre-C++11. We can use lambdas now.