Skip to content

Commit de8bfc5

Browse files
evanlinjinclaude
andcommitted
refactor!: drop rand dependency from the library
create_psbt no longer needs an RNG (AFS — the only consumer — takes its own rng explicitly), so the create_psbt_with_rng wrapper and its thread_rng() call were dead weight. Collapses both into a single create_psbt(self, params) and moves rand to dev-dependencies. The library now depends only on rand_core (for the RngCore trait) + miniscript + bdk_coin_select. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c460cbb commit de8bfc5

2 files changed

Lines changed: 1 addition & 11 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] }
1818
bdk_coin_select = { version = "0.4.1" }
1919
miniscript = { version = "12.3.7", default-features = false }
2020
rand_core = { version = "0.6.4", default-features = false }
21-
rand = { version = "0.8", optional = true }
2221

2322
[dev-dependencies]
2423
anyhow = "1"
@@ -27,6 +26,7 @@ bitcoin = { version = "0.32.10", default-features = false, features = ["rand-std
2726
bdk_testenv = "0.13.0"
2827
bdk_bitcoind_rpc = "0.22.0"
2928
bdk_chain = { version = "0.23.3" }
29+
rand = "0.8"
3030

3131
[features]
3232
default = ["std"]

src/tx_template.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -385,17 +385,7 @@ impl TxTemplate {
385385
}
386386

387387
/// Build the [`Psbt`] and its associated [`Finalizer`].
388-
#[cfg(feature = "std")]
389388
pub fn create_psbt(self, params: PsbtBuildParams) -> Result<(Psbt, Finalizer), BuildPsbtError> {
390-
self.create_psbt_with_rng(params, &mut rand::thread_rng())
391-
}
392-
393-
/// Build the [`Psbt`] and its associated [`Finalizer`] with a custom `rng`.
394-
pub fn create_psbt_with_rng(
395-
self,
396-
params: PsbtBuildParams,
397-
_rng: &mut impl RngCore,
398-
) -> Result<(Psbt, Finalizer), BuildPsbtError> {
399389
let tx = self.to_unsigned_tx();
400390
let mut psbt = Psbt::from_unsigned_tx(tx).map_err(BuildPsbtError::Psbt)?;
401391

0 commit comments

Comments
 (0)