docs(esplora): replace misleading tx-cache TODO with explanation - #2261
docs(esplora): replace misleading tx-cache TODO with explanation#2261Arowolokehinde wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2261 +/- ##
=======================================
Coverage 78.36% 78.36%
=======================================
Files 30 30
Lines 5945 5945
Branches 281 281
=======================================
Hits 4659 4659
Misses 1210 1210
Partials 76 76
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
I'd just add a short comment stating that a tx cache does not apply in this scenario, and change the TODO to say that the per-outpoint |
|
Changes has been made as required to the comment @luisschwab |
|
The commits should be squashed |
fe79cea to
46015d5
Compare
46015d5 to
a81add9
Compare
|
i just squashed the commit |
|
@luisschwab kindly review |
How do you propose that we optimize this? I prefer if we create a ticket instead of having a TODO comment in the codebase. Tickets are easier to track. I'm responsible for writing the initial TODO comment and I apologize for creating this precedent. |
Description
fetch_txs_with_outpointscarried a misleading// TODO: We should maintain a tx cache (like we do with Electrum).comment in bothasync_ext.rsandblocking_ext.rs. Electrum needs a cache because its history call returns txids only, forcing a follow-up fetch per tx. Esplora's scan endpoint already returns full tx bodies, so there's no equivalent fetch for a cache to skip — andinserted_txsalready dedupes against what the spk phase fetched earlier in the same sync.This PR replaces the TODO with a comment explaining why, and why the obvious "fix" — using
get_tx_statusinstead ofget_tx_infofor cache hits — is unsafe: unknown txids return HTTP 200{"confirmed":false}, indistinguishable from a real unconfirmed tx, so evicted transactions would never be evicted.Fixes #2260
Notes to the reviewers
The TODO already cost a contributor a 600-line PR (#2254, closing #2250) implementing exactly this cache, which was caught in review for the
get_tx_statuseviction bug described above. This comment exists to stop that from being rediscovered a third time.Changelog notice
Removed a misleading TODO in
fetch_txs_with_outpointssuggesting a tx cache be added; replaced with a comment explaining why the Electrum-style cache pattern does not apply to Esplora.Checklists
All Submissions:
I followed the contribution guidelines
I'm linking the issue being fixed by this PR