Skip to content

Commit

Permalink
temp3
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Dec 15, 2023
1 parent f8b9ecd commit f52c9af
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions bdk-ffi/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ pub struct Wallet {
inner_mutex: Mutex<BdkWallet>,
}



// TODO: I don't understand well these lifetime parameters yet
pub struct PersistedWallet<'a> {
inner_mutex: Mutex<BdkWallet<Store<'a, ChangeSet>>>,
pub struct PersistedWallet {
inner_mutex: Mutex<BdkWallet<Arc<Store<ChangeSet>>>>,
}

// TODO: I don't understand well these lifetime parameters yet
impl<'a> PersistedWallet<'a> {
impl PersistedWallet {
pub fn new(
descriptor: Arc<Descriptor>,
change_descriptor: Option<Arc<Descriptor>>,
Expand All @@ -42,7 +44,7 @@ impl<'a> PersistedWallet<'a> {
) -> Result<Self, TempFfiError> {
let descriptor = descriptor.as_string_private();
let change_descriptor = change_descriptor.map(|d| d.as_string_private());
let db = Store::<ChangeSet>::open_or_create_new("testbdkffi".as_bytes(), persistence_backend_path)?;
let db = Arc::new(Store::<ChangeSet>::open_or_create_new("testbdkffi".as_bytes(), persistence_backend_path))?;

let wallet: bdk::wallet::Wallet<Store<ChangeSet>> = BdkWallet::new(
&descriptor,
Expand All @@ -56,7 +58,7 @@ impl<'a> PersistedWallet<'a> {
})
}

pub(crate) fn get_wallet(&self) -> MutexGuard<BdkWallet<Store<'a, ChangeSet>>> {
pub(crate) fn get_wallet(&self) -> MutexGuard<BdkWallet<Store<ChangeSet>>> {
self.inner_mutex.lock().expect("wallet")
}

Expand Down

0 comments on commit f52c9af

Please sign in to comment.