From 484f73a33bb6018bcbc83814c36acce14110935e Mon Sep 17 00:00:00 2001 From: Forte11Cuba Date: Tue, 31 Mar 2026 03:36:16 -0600 Subject: [PATCH] fix: only reclaim proofs explicitly reported as Unspent by mint --- rust/src/api/wallet.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/rust/src/api/wallet.rs b/rust/src/api/wallet.rs index 4033988..aa534bb 100644 --- a/rust/src/api/wallet.rs +++ b/rust/src/api/wallet.rs @@ -398,9 +398,11 @@ impl Wallet { let states = self.inner.check_proofs_spent(pending).await?; // Collect Y values of proofs the mint says are NOT spent + // Only reclaim proofs the mint explicitly reports as Unspent. + // Pending proofs (still being processed) must not be unreserved. let unspent_ys: Vec = states .into_iter() - .filter(|s| s.state != ProofState::Spent) + .filter(|s| s.state == ProofState::Unspent) .map(|s| s.y) .collect(); @@ -408,9 +410,10 @@ impl Wallet { if count > 0 { // Revert from PendingSpent to Unspent self.inner.unreserve_proofs(unspent_ys).await?; - self.update_balance_streams().await; } + // Always refresh: check_proofs_spent may have removed spent proofs + self.update_balance_streams().await; Ok(count) }