bdk icon indicating copy to clipboard operation
bdk copied to clipboard

Remove dependency on rand

Open LLFourn opened this issue 2 years ago • 4 comments

Because we invoke thread_rng directly we have to also depend on getrandom in order to set certain feature flags to get things to compile on wasm.

Can we just depend on rand_core and let users pass in anything implement RngCore? This would simplify dependencies a bit. The place where this will be most tricky is in tx building but I hope it can be done.

We should try and attempt this before v1.

LLFourn avatar Feb 21 '23 04:02 LLFourn

Would this imply TxBuilder would be initiated with impl Into<RngCore>? My gut feeling is that would cause problems for the UniFFI bindings.

rustaceanrob avatar Mar 22 '24 22:03 rustaceanrob

Ok but the FFI bindings can depend on rand and pass in ThreadRng if they want to?

LLFourn avatar Mar 28 '24 00:03 LLFourn

Good point. I will try working on this.

rustaceanrob avatar Mar 28 '24 00:03 rustaceanrob

We could consider making TxParams generic over R and adding a field rng: Option<R>.

ValuedMammal avatar Apr 07 '24 23:04 ValuedMammal