Skip to content

fix(mempool): make initial-sync tx insertion idempotent#61

Open
torkelrogstad wants to merge 1 commit into
masterfrom
2026-06-30-alreadyexists
Open

fix(mempool): make initial-sync tx insertion idempotent#61
torkelrogstad wants to merge 1 commit into
masterfrom
2026-06-30-alreadyexists

Conversation

@torkelrogstad

@torkelrogstad torkelrogstad commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Skip re-inserting a tx already in the mempool instead of failing the whole sync task with TxAlreadyExists. The RPC snapshot and live ZMQ sequence stream can queue the same txid twice.

Reported here: LayerTwo-Labs/bip300301_enforcer#406

Skip re-inserting a tx already in the mempool instead of failing the
whole sync task with TxAlreadyExists. The RPC snapshot and live ZMQ
sequence stream can queue the same txid twice.
Comment thread lib/mempool/sync/task.rs
// `Mempool::insert` fail with `TxAlreadyExists` and abort the whole sync
// task, so treat an already-present tx as a successfully-applied no-op.
if inner.mempool.txs.0.contains_key(&txid) {
inner.unfiltered_mempool.txs.insert(txid);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct - the filtered mempool should always be a subset of the unfiltered mempool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants