Repository navigation
Emit mempool transactions that share a timestamp - #1177
Open
ajaysehwal wants to merge 1 commit into
Open
ajaysehwal wants to merge 1 commit into
ajaysehwal wants to merge 1 commit into
Conversation
|
I've assigned @tnull as a reviewer! |
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.
Fixes #1140.
get_mempool_transactions_and_timestamp_at_heightdecided whether a mempool transaction had already been emitted solely by comparing its entry time to the saved cursor. Bitcoin Core's mempool entry times only have second resolution, so a new transaction that shares the second of an already emitted one was skipped, and kept being skipped for as long as it stayed unconfirmed. The wallet then missed the unconfirmed payment until it confirmed in a block.We now track emitted txids instead:
entry.height <= best_processed_heightcheck is unchanged).The timestamp cursor is still used for the evicted-transaction timestamps, and the transaction body cache is unchanged, so correctness no longer depends on cache retention.
Testing
The selection logic is a separate function with unit tests for: a new txid sharing the cursor's second is emitted, emitted transactions aren't repeated, lagging ancestors are emitted again, eviction and re-entry, and a failed poll not being remembered. The same-second, re-entry and failed-poll tests fail with the previous timestamp-only rule and pass with this change. The full lib test suite passes, as do
cargo +nightly fmt --checkandcargo clippy --lib -- -D clippy::unwrap_used.AI disclosure
This change was prepared with the assistance of Claude Code.