Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix summary tx ordering #94

Merged

Conversation

mononaut
Copy link
Contributor

@mononaut mononaut commented May 13, 2024

(build on #93)

does not require an additional re-index after #93

This PR takes advantage of the tx_position component of the address history index to ensure that transactions returned by the .../txs/summary endpoints are also correctly ordered.

This fixes some issues with the address balance charts on mempool.space, where the total balance could spike higher than it should when the same coins are recycled through multiple transactions in the same block.

E.g, for the address bc1pn8ynw7a0fec5daqfv7h4r2hvta82dpsztcu30s4fgh2958yd7pkqnrkkjy

Before: many erroneous balance spikes, for example when the same ~4k sats is received and spent twice in the same block across four transactions, we incorrectly show the balance spiking to 8k sats because the events are out of order:
Screenshot 2024-05-13 at 6 49 08 PM

After: the balance chart is correct:
Screenshot 2024-05-13 at 6 49 20 PM

@mononaut mononaut requested review from wiz and junderw May 13, 2024 18:55
@junderw
Copy link
Member

junderw commented May 13, 2024

You could point this PR to junderw/order_txes_in_block and we can merge it into #93 before merging it.

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

@mononaut mononaut changed the base branch from mempool to junderw/order_txes_in_block May 13, 2024 22:09
@junderw junderw merged commit 7fc4912 into junderw/order_txes_in_block May 14, 2024
7 checks passed
@junderw junderw deleted the mononaut/fix-summary-tx-ordering branch May 14, 2024 00:44
@junderw
Copy link
Member

junderw commented May 14, 2024

Merged into #93

SatoKentaNayoro pushed a commit to boolnetwork/mempool-electrs that referenced this pull request Nov 29, 2024
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