Skip to content

fix: continue address tx pagination across mempool boundary#143

Merged
mononaut merged 2 commits into
mempoolfrom
junderw/fix-txs-endpoint
Apr 18, 2026
Merged

fix: continue address tx pagination across mempool boundary#143
mononaut merged 2 commits into
mempoolfrom
junderw/fix-txs-endpoint

Conversation

@junderw
Copy link
Copy Markdown
Member

@junderw junderw commented Mar 26, 2026

Closes #142

The address tx history endpoints could stop pagination at the mempool/chain boundary when after_txid pointed to the last mempool transaction for an address or address group. The confirmed-history query was reusing after_txid whenever the mempool query returned no rows, even if that cursor only existed in mempool. This change makes the confirmed-history query reuse after_txid only when the cursor was actually found in chain history; mempool cursors now correctly fall through to the newest confirmed transactions.

@junderw junderw force-pushed the junderw/fix-txs-endpoint branch 2 times, most recently from 3667723 to 26213ac Compare March 26, 2026 15:39
The address tx history endpoints could stop pagination at the mempool/chain boundary when after_txid pointed to the last mempool transaction for an address or address group. The confirmed-history query was reusing after_txid whenever the mempool query returned no rows, even if that cursor only existed in mempool. This change makes the confirmed-history query reuse after_txid only when the cursor was actually found in chain history; mempool cursors now correctly fall through to the newest confirmed transactions.

Co-authored-by: Saravanan Mani <228955468+saravanan7mani7@users.noreply.github.com>
@junderw junderw force-pushed the junderw/fix-txs-endpoint branch from 26213ac to 98ae002 Compare March 26, 2026 15:47
@junderw junderw requested review from Copilot and mononaut April 17, 2026 13:48
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes address transaction history pagination when after_txid points to the last mempool transaction, ensuring pagination continues into confirmed (chain) history instead of returning an empty page.

Changes:

  • Adds confirmed_after_txid() to ensure confirmed-history pagination only reuses after_txid when the cursor is known to be in chain history.
  • Updates both single-address and multi-address tx history endpoints to use the new cursor selection logic.
  • Adds unit tests covering the new cursor-selection behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

@mononaut mononaut left a comment

Choose a reason for hiding this comment

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

Tested ACK @ [10f42b5]

@mononaut mononaut merged commit 8aa0cc0 into mempool Apr 18, 2026
12 checks passed
@mononaut mononaut deleted the junderw/fix-txs-endpoint branch April 18, 2026 01:28
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.

electrs: after_txid pagination can stop at mempool/chain boundary for address tx history

4 participants