From ef3ecce3cf976a981c413082e944f3d2bc8300c0 Mon Sep 17 00:00:00 2001 From: Mubarak Muhammad Aminu Date: Fri, 11 Oct 2024 17:02:53 +0100 Subject: [PATCH] feat(cdk_sdk):remove spent proof and update db state (#393) --- crates/cdk/src/wallet/proofs.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/cdk/src/wallet/proofs.rs b/crates/cdk/src/wallet/proofs.rs index 3eff5cf8c..9d652f171 100644 --- a/crates/cdk/src/wallet/proofs.rs +++ b/crates/cdk/src/wallet/proofs.rs @@ -111,6 +111,16 @@ impl Wallet { .collect::, _>>()?, ) .await?; + let spent_ys: Vec<_> = spendable + .states + .iter() + .filter_map(|p| match p.state { + State::Spent => Some(p.y), + _ => None, + }) + .collect(); + + self.localstore.update_proofs(vec![], spent_ys).await?; Ok(spendable.states) }