Mempool preconfs: Cleanup contract_users only after rollback#3268
Mempool preconfs: Cleanup contract_users only after rollback#3268
Conversation
…fer contract_users cleanup until after rollback
PR SummaryMedium Risk Overview Updates the Reviewed by Cursor Bugbot for commit 8830a0a. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 05a8cf7. Configure here.

See #3264 (comment)
Description
Problem
on_removed_transactionwas called for both block-committed transactions and pool evictions, which meantcontract_usersentries were cleaned up beforerollback_preconfirmed_transactioncould use them to find and evict dependent pool transactions.Solution
Add
on_committed_transaction(same ason_removed_transactionbut skips theInput::Contractcleanup) andremove_from_contract_users(only theInput::Contractcleanup) to theCollisionManagertrait andBasicCollisionManager. Block-commitment paths inpool.rsnow useon_committed_transactionand return the removed pool transactions to their callers.pool_worker.rsdefersremove_from_contract_usersuntil after all preconfirmation rollback for the relevant block height is complete. This ensures rollback always observes the full set of contract dependents.Checklist
Before requesting review