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

Fixes #11 #6

Open
Coretaker101 opened this issue Dec 5, 2023 · 0 comments
Open

Fixes #11 #6

Coretaker101 opened this issue Dec 5, 2023 · 0 comments

Comments

@Coretaker101
Copy link

Fixes #11


Requires re-index? == No

Affects API interface AND/OR response data format? == No


Explanation:

TxHistoryRow is just a key in rocksdb. Which means it is encoding all its information into the key and (most likely intentionally) using the property that inserting the same key twice will de-duplicate to its advantage.

In the case where txA is confirmed in orphaned block at height 10, returned to our mempool, then confirmed in new-best-chain block 15 etc. The keys are not the same (since the key contains the block height).

Other endpoints use unique() on txid etc. so there shouldn't be any problems with the other endpoints... However, this can't be properly fixed without a re-working of the index (which will require a re-index of esplora)

For now, we avoid unique() since it would just give the same result, and instead use unique_by and return a tuple of the txid + the outpoint (for spends it's the previous outpoint, for funds it's this txid+this output index. If we don't include the txid(), then it would remove the spend of each fund->spend pair)

Note: utxo_delta does not have the same problem because it uses a HashMap with the Outpoint as the key to accumulate the results, removing any duplicates.

Originally posted by @junderw in mempool/electrs#12

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

No branches or pull requests

1 participant