Skip to content

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

Merged
oleonardolima merged 1 commit into
bitcoindevkit: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 into
bitcoindevkit:masterfrom
phrwlk:fix/esplora-dedup-missing-txids-outpoints

Conversation

@phrwlk

@phrwlk phrwlk commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

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

@evanlinjin evanlinjin left a comment

Copy link
Copy Markdown
Member

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

phrwlk commented Jan 27, 2026

Copy link
Copy Markdown
Contributor Author

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

@evanlinjin evanlinjin left a comment

Copy link
Copy Markdown
Member

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

@oleonardolima oleonardolima left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
Collaborator

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

@notmandatory

Copy link
Copy Markdown
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

@oleonardolima oleonardolima left a comment

Copy link
Copy Markdown
Collaborator

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.

@luisschwab luisschwab left a comment

Copy link
Copy Markdown
Member

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
oleonardolima added a commit that referenced this pull request Jun 17, 2026
81335d8 fix(esplora): deduplicate missing txids in fetch_txs_with_outpoints (phrwlk)

Pull request description:

  ### Description

  It's a backport for the the `bdk_esplora` fix introduced by #2104. If you're interested in the original fix, check the original PR for discussion/rationale.

  ### Changelog notice

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

  ### Checklists

  #### All Submissions:

  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  oleonardolima:
    self-ACK 81335d8
  luisschwab:
    ACK 81335d8

Tree-SHA512: 9d2ad6f97550fdbb3fb0a455b0f2fb2866023fa368dc67241b1b1493125de8cc70863014c2700770555294f8933f8524fa6ad9a243ddeb0395052d7491ef1c3a
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