Skip to content

fix(esplora): deduplicate missing txids in fetch_txs_with_outpoints#2104

Merged
oleonardolima merged 1 commit intobitcoindevkit:masterfrom
phrwlk:fix/esplora-dedup-missing-txids-outpoints
Mar 20, 2026
Merged

fix(esplora): deduplicate missing txids in fetch_txs_with_outpoints#2104
oleonardolima merged 1 commit intobitcoindevkit:masterfrom
phrwlk:fix/esplora-dedup-missing-txids-outpoints

Conversation

@phrwlk
Copy link
Contributor

@phrwlk phrwlk commented Jan 26, 2026

Description

Previously fetch_txs_with_outpoints collected spend txids into a Vec, so the same txid could be pushed multiple times when one transaction spent several input outpoints. This caused redundant get_tx_info calls to Esplora for the same transaction, wasting network and CPU without changing the resulting TxUpdate.

Use HashSet<Txid> for missing_txs in both async and blocking fetch_txs_with_outpoints, so each txid is only requested once while keeping the observable behaviour of SyncResponse / TxUpdate unchanged.

Changelog notice


### Changed
- Use `HashSet` instead of `Vec` to track `missing_txs` in bdk_esplora, it deduplicates txids.

Checklists

All Submissions:

New Features:

  • I've added tests for the new feature
  • I've added docs for the new feature

Bugfixes:

  • This pull request breaks the existing API
  • I've added tests to reproduce the issue which are now passing
  • I'm linking the issue being fixed by this PR

Copy link
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

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

cACK

Looks good, thanks for fixing this.

Just a minor thing before merging - could you combine the two commits and include the scope?

I.e.

fix(esplora): deduplicate missing txids in fetch_txs_with_outpoints

@phrwlk phrwlk force-pushed the fix/esplora-dedup-missing-txids-outpoints branch from 2c95146 to 0071ee6 Compare January 27, 2026 13:10
@phrwlk phrwlk changed the title Fix/esplora dedup missing txids outpoints fix(esplora): deduplicate missing txids in fetch_txs_with_outpoints Jan 27, 2026
@phrwlk
Copy link
Contributor Author

phrwlk commented Jan 27, 2026

cACK

Looks good, thanks for fixing this.

Just a minor thing before merging - could you combine the two commits and include the scope?

I.e.

fix(esplora): deduplicate missing txids in fetch_txs_with_outpoints

Did it

Copy link
Member

@evanlinjin evanlinjin left a comment

Choose a reason for hiding this comment

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

ACK 787e07c

@evanlinjin evanlinjin force-pushed the fix/esplora-dedup-missing-txids-outpoints branch from 0071ee6 to 787e07c Compare January 28, 2026 04:48
@oleonardolima oleonardolima self-requested a review February 2, 2026 15:43
Copy link
Collaborator

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

cACK 787e07c

@oleonardolima
Copy link
Collaborator

Can you update the PR description to follow the template, and also add the changelog changes in it ?

@notmandatory
Copy link
Member

This will also need a rebase also since I merged #2123.

@oleonardolima oleonardolima force-pushed the fix/esplora-dedup-missing-txids-outpoints branch from 787e07c to 3b6b3ba Compare March 19, 2026 22:14
Copy link
Collaborator

@oleonardolima oleonardolima left a comment

Choose a reason for hiding this comment

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

ACK 3b6b3ba

I did rebase and update the description.

Copy link
Member

@luisschwab luisschwab left a comment

Choose a reason for hiding this comment

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

ACK 3b6b3ba

@oleonardolima oleonardolima merged commit 0f89edb into bitcoindevkit:master Mar 20, 2026
17 checks passed
@github-project-automation github-project-automation bot moved this from Needs Review to Done in BDK Chain Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants