Skip to content

Commit e9c2962

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 07262fd commit e9c2962

2 files changed

Lines changed: 2 additions & 12 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] }
1717
miniscript = { version = "12.3.5", default-features = false }
1818
bdk_coin_select = "0.4.0"
1919
rand_core = { version = "0.6.4", default-features = false }
20-
rand = { version = "0.8", optional = true }
2120

2221
[dev-dependencies]
2322
anyhow = "1"
@@ -26,10 +25,11 @@ bitcoin = { version = "0.32", default-features = false, features = ["rand-std"]
2625
bdk_testenv = "0.13.0"
2726
bdk_bitcoind_rpc = "0.20.0"
2827
bdk_chain = { version = "0.23.0" }
28+
rand = "0.8"
2929

3030
[features]
3131
default = ["std"]
32-
std = ["miniscript/std", "rand/std"]
32+
std = ["miniscript/std"]
3333

3434
[[example]]
3535
name = "synopsis"

src/tx_template.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -393,17 +393,7 @@ impl TxTemplate {
393393
}
394394

395395
/// Build the [`Psbt`] and its associated [`Finalizer`].
396-
#[cfg(feature = "std")]
397396
pub fn create_psbt(self, params: PsbtBuildParams) -> Result<(Psbt, Finalizer), BuildPsbtError> {
398-
self.create_psbt_with_rng(params, &mut rand::thread_rng())
399-
}
400-
401-
/// Build the [`Psbt`] and its associated [`Finalizer`] with a custom `rng`.
402-
pub fn create_psbt_with_rng(
403-
self,
404-
params: PsbtBuildParams,
405-
_rng: &mut impl RngCore,
406-
) -> Result<(Psbt, Finalizer), BuildPsbtError> {
407397
let tx = self.to_unsigned_tx();
408398
let mut psbt = Psbt::from_unsigned_tx(tx).map_err(BuildPsbtError::Psbt)?;
409399

0 commit comments

Comments
 (0)