Browse Source

feat(cdk_sdk):remove spent proof and update db state (#393)

Mubarak Muhammad Aminu 5 months ago
parent
commit
ef3ecce3cf
1 changed files with 10 additions and 0 deletions
  1. 10 0
      crates/cdk/src/wallet/proofs.rs

+ 10 - 0
crates/cdk/src/wallet/proofs.rs

@@ -111,6 +111,16 @@ impl Wallet {
                     .collect::<Result<Vec<PublicKey>, _>>()?,
             )
             .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)
     }