Skip to content

Date mempool absences with our own clock - #1127

Open
tnull wants to merge 1 commit into
lightningdevkit:mainfrom
tnull:2026-10-mempool-eviction-timestamp
Open

tnull wants to merge 1 commit into
lightningdevkit:mainfrom
tnull:2026-10-mempool-eviction-timestamp

Conversation

@tnull

@tnull tnull commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator
The bitcoind chain source dated a transaction's absence from the
mempool with the newest mempool entry time it had seen since startup.
That watermark restarts at zero while the transaction's `last_seen`
persists with the wallet, and BDK keeps an evicted transaction
canonical until its eviction catches up with `last_seen`, so a
transaction that vanished while we were down kept its input marked
spent and its change counted as ours.

Date the observations we hand BDK with our local clock instead, as the
Esplora and Electrum sources and upstream `bdk_bitcoind_rpc` do, and
keep the entry-time watermark for emission deduplication only.

This only bites after a restart, and only while the mempool holds
nothing newer than the transaction: otherwise the first poll re-emits
the whole mempool and advances the watermark before that same poll
reports any eviction. In practice that means an empty mempool on
signet or regtest, or a similarly idle backend, and the next
transaction to arrive resolves it anyway.

@ldk-reviews-bot

ldk-reviews-bot commented Oct 5, 2026 •

Copy link
Copy Markdown

I've assigned @tankyleo as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tnull
tnull force-pushed the 2026-10-mempool-eviction-timestamp branch from a1b3a67 to 7cf257c Compare October 5, 2026 09:33
The bitcoind chain source dated a transaction's absence from the
mempool with the newest mempool entry time it had seen since startup.
That watermark restarts at zero while the transaction's `last_seen`
persists with the wallet, and BDK keeps an evicted transaction
canonical until its eviction catches up with `last_seen`, so a
transaction that vanished while we were down kept its input marked
spent and its change counted as ours.

Date the observations we hand BDK with our local clock instead, as the
Esplora and Electrum sources and upstream `bdk_bitcoind_rpc` do, and
keep the entry-time watermark for emission deduplication only.

This only bites after a restart, and only while the mempool holds
nothing newer than the transaction: otherwise the first poll re-emits
the whole mempool and advances the watermark before that same poll
reports any eviction. In practice that means an empty mempool on
signet or regtest, or a similarly idle backend, and the next
transaction to arrive resolves it anyway.

Co-Authored-By: HAL 9000
@tnull
tnull force-pushed the 2026-10-mempool-eviction-timestamp branch from 7cf257c to 4c3b31c Compare October 5, 2026 09:35
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