Skip to content

Emit newly observed mempool transactions sharing a timestamp #1140

Description

@tnull

At main 1dea48a5ea06e5af2eabbf0633b32aee3338bd6c, get_mempool_transactions_and_timestamp_at_height_inner classifies a transaction as already emitted using only entry.time <= prev_mempool_time. Bitcoin Core's mempool entry timestamps have second resolution.

If transaction A advances the saved cursor to second T and a new transaction B appears in the next poll with the same entry timestamp T, B is skipped whenever entry.height <= best_processed_height. This happens before fetching or caching B's body. Subsequent polls keep skipping B while it remains unconfirmed, so the wallet misses its unconfirmed payment/balance update. Confirmation processing remains available.

Track emitted transaction identities independently of full transaction-body caching, and emit a newly observed txid even if it shares the previous cursor second. Define eviction/re-entry behavior and preserve the existing ancestor-height handling. Using body-cache membership alone couples correctness to cache retention and is not a complete design.

PR #1127 changes observation/eviction timestamps handed to BDK, but head 4c3b31cf0ca45dc662b5bc89fdb2a25910201ce8, reviewed on 2026-10-09, retains the timestamp-only deduplication check at src/chain/bitcoind.rs:1273-1276. This finding therefore remains separate from that fix.

Add a regression with an advanced cursor and a previously unseen txid in the same second. Verify that it is emitted, previously emitted transactions are not unnecessarily repeated, and eviction/re-entry and lagging ancestors behave correctly. The regression must fail on the pre-fix code and pass after the fix. This report is based on source review; no PoC or regression test was run.

This finding was discovered by Project Loupe.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions