Repository navigation
fix(esplora): use HashSet::new in fetch_txs_with_outpoints - #2460
Open
BarbieRajput wants to merge 1 commit into
Open
BarbieRajput wants to merge 1 commit into
BarbieRajput wants to merge 1 commit into
Conversation
Without the `std` feature, `bdk_core::collections::HashSet` is an alias for `BTreeSet`, which has no `with_capacity`. This broke builds that enable `blocking` or `async` without `std`. Use `HashSet::new` instead, which exists for both collection types. Fixes bitcoindevkit#2459
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #2459.
fetch_txs_with_outpointscallsHashSet::<Txid>::with_capacity(..). Without thestdfeature,bdk_core::collections::HashSetis an alias forBTreeSet, which has nowith_capacity, sobdk_esplorafails to compile withblockingorasyncunlessstdis also enabled.This PR uses
HashSet::<Txid>::new()in bothblocking_ext.rsandasync_ext.rs, which works for either collection type.Notes to the reviewers
This has no regression test because dev-dependencies enable
bdk_core/std, so test builds can't reproduce it. I checked it with:for
blocking,async,blocking-https,blocking-https-rustls,blocking-https-native,async-https,async-https-rustlsandasync-https-native. All 8 failed before this change and pass now.cargo test -p bdk_esplora --all-featuresalso passes.Published
bdk_esplora0.22.3 is affected too, so this needs a backport torelease/chain-0.23.x.CI currently builds
async/blockingonly together withstd. An alternative fix is to make those features implystdinCargo.toml. I went withHashSet::newbecause it's the smaller change and keepsstdoptional. Happy to switch if you prefer that.I can also add a CI step (
cargo build --no-default-features --features blocking/async) to catch this in future, either here as a separate commit or in a follow-up PR.Changelog notice
Fixed
bdk_esplora:blockingandasyncfeatures compile again withoutstd. fix(esplora): use HashSet::new in fetch_txs_with_outpoints #2460Checklists
All Submissions:
Bugfixes: