feat: Retain pruned transactions until pruned block is finalised#20237
Merged
Conversation
327f014 to
791b20f
Compare
alexghr
approved these changes
Feb 10, 2026
alexghr
left a comment
Contributor
There was a problem hiding this comment.
We agreed to remove txs from the DeletePool once they re-mine in order to keep tracking consisten.
52e5dae to
4fa40a0
Compare
c77a310 to
1a58977
Compare
## Summary Implements soft deletion for transactions from pruned blocks in TxPoolV2: - **Transactions from pruned blocks are soft-deleted** - kept in DB for later re-execution - **Transactions NOT from pruned blocks are hard-deleted** - removed from DB immediately as before - **Soft-deleted txs are retrievable** via `getTxByHash` and `hasTxs`, with status `'deleted'` from `getTxStatus` - **Hard deletion on finalization** - soft-deleted txs are permanently removed when their original mined block is finalized ### Key Design Decisions 1. **Track mined block, not prune point**: When a tx is un-mined due to a reorg, we track the block it was *mined* in, not the block we pruned to. This ensures the tx is kept until that block is finalized on the new chain. 2. **Handle re-mining**: If a tx is mined at block 4, pruned, re-mined at block 5, then pruned again, we track block 5 (the higher value). The tx is only hard-deleted when block 5 is finalized. 3. **Single source of truth**: `DeletedPool` is responsible for ALL deletion decisions. It determines whether to soft-delete or hard-delete based on whether the tx is from a pruned block. ### Example Scenario ``` 1. Tx mined at block 10 2. Chain prunes to block 5 (tx un-mined, tracked as minedAtBlock=10) 3. Tx fails validation and is soft-deleted 4. Block 9 finalized → tx still in DB 5. Block 10 finalized → tx hard-deleted ``` ## Test plan - 177 tx_pool_v2 tests pass - 17 deleted_pool tests pass - Test: tx mined, pruned, soft-deleted, finalized at correct block - Test: tx re-mined at higher block, tracked correctly - Test: multiple txs with different mined blocks finalize at correct times - Test: persistence across restarts 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1a58977 to
b05a66e
Compare
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Feb 11, 2026
BEGIN_COMMIT_OVERRIDE chore(ci3): add optional local cache for bootstrap artifacts (#20305) fix: Fix p2p integration test (#20331) chore: reduce fee log severity (#20336) feat: restrict response sizes to expected sizes (#20287) feat: retry web3signer connection (#20342) feat(p2p): Integrate TxPoolV2 across codebase (#20172) feat: review and optimize Claude configuration, agents, and skills (#20270) fix(prover): handle cross-chain messages when proving mbps (#20354) chore: retry flakes. if retry pass, is a flake as we know it now. fail both is hard fail (#19322) chore(p2p): add mock reqresp layer for tests (#20370) fix: (A-370) don't propagate on tx mempool add failure (#20374) chore: Skip the HA test (#20376) feat: Retain pruned transactions until pruned block is finalised (#20237) END_COMMIT_OVERRIDE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements soft deletion for transactions from pruned blocks in TxPoolV2:
getTxByHashandhasTxs, with status'deleted'fromgetTxStatusKey Design Decisions
Track mined block, not prune point: When a tx is un-mined due to a reorg, we track the block it was mined in, not the block we pruned to. This ensures the tx is kept until that block is finalized on the new chain.
Handle re-mining: If a tx is mined at block 4, pruned, re-mined at block 5, then pruned again, we track block 5 (the higher value). The tx is only hard-deleted when block 5 is finalized.
Single source of truth:
DeletedPoolis responsible for ALL deletion decisions. It determines whether to soft-delete or hard-delete based on whether the tx is from a pruned block.Example Scenario
Test plan
🤖 Generated with Claude Code