Skip to content

Conversation

@mononaut
Copy link
Contributor

@mononaut mononaut commented Feb 28, 2025

REINDEX NOT REQUIRED

Some of the fancy rayon parallelization stuff in 2fbb017 broke the expected ordering of results returned by lookup_txns, since par_bridge does not guarantee order is preserved.

This causes transactions from /address/.../txs and /addresses/txs endpoints to be returned in non-deterministic order.

The actual pagination is still correct, since the order gets scrambled after we find the correct set of transactions to return, although it's now not always possible to tell which transaction to use for the after_txid param for the next page.

This PR implements a simple fix by modifying lookup_txns and associated methods to include tx_position as well as blockid for each transaction in the results, and then uses that data to explicitly re-sort the final results before they are returned.

@mononaut mononaut requested a review from junderw February 28, 2025 03:11
Copy link
Member

@junderw junderw left a comment

Choose a reason for hiding this comment

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

LGTM

I fixed fmt and clippy.

I checked all the usages of the touched functions to see if we're missing something. It looks like we aren't.

@softsimon softsimon merged commit 6cb9bec into mempool Feb 28, 2025
7 checks passed
@softsimon softsimon deleted the mononaut/fix-address-history-ordering branch February 28, 2025 10:15
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.

4 participants