]> Untitled Git - bdk/commit
fix(wallet): allow PersistedWallet<P> to be Send + Sync even if P is !Sync
authorSteve Myers <steve@notmandatory.org>
Thu, 6 Mar 2025 03:12:02 +0000 (21:12 -0600)
committerSteve Myers <steve@notmandatory.org>
Mon, 10 Mar 2025 21:41:22 +0000 (16:41 -0500)
commit14251a43be73796f0db98cee8a0b5e88e4b4c51a
treec9fb66af39e493d93b8f820f3f84e4e143f07b84
parent3abde00bd7ae05c47e6a00bb112e0e41fb7bdcbc
fix(wallet): allow PersistedWallet<P> to be Send + Sync even if P is !Sync

The goal of this change is to ensure that PersistWallet<P> remains Send and Sync, even if the functions implemented on it
have a &mut P parameter and P is not Sync.

The reason to change PersistWallet<P>'s _marker field type from PhatonData<P> to PhantomData<fn(&mut P)> is to tell the
Rust compiler that this struct is a "consumer" of &mut P, but it does not own P and therefore should not be tied to its
lifetime.
crates/wallet/src/wallet/persisted.rs
crates/wallet/tests/wallet.rs