diff --git a/crates/cdk/src/mint/melt.rs b/crates/cdk/src/mint/melt.rs index 7cd935f6..3b50f7c8 100644 --- a/crates/cdk/src/mint/melt.rs +++ b/crates/cdk/src/mint/melt.rs @@ -385,7 +385,7 @@ impl Mint { let input_ys = melt_request.inputs.ys()?; self.localstore - .update_proofs_states(&input_ys, State::Unspent) + .remove_proofs(&input_ys, Some(melt_request.quote)) .await?; self.localstore diff --git a/crates/cdk/src/mint/swap.rs b/crates/cdk/src/mint/swap.rs index dba94ecc..915e6096 100644 --- a/crates/cdk/src/mint/swap.rs +++ b/crates/cdk/src/mint/swap.rs @@ -72,18 +72,14 @@ impl Mint { .len() .ne(&proof_count) { - self.localstore - .update_proofs_states(&input_ys, State::Unspent) - .await?; + self.localstore.remove_proofs(&input_ys, None).await?; return Err(Error::DuplicateProofs); } for proof in &swap_request.inputs { if let Err(err) = self.verify_proof(proof).await { tracing::info!("Error verifying proof in swap"); - self.localstore - .update_proofs_states(&input_ys, State::Unspent) - .await?; + self.localstore.remove_proofs(&input_ys, None).await?; return Err(err); } } @@ -100,9 +96,7 @@ impl Mint { } None => { tracing::info!("Swap request with unknown keyset in inputs"); - self.localstore - .update_proofs_states(&input_ys, State::Unspent) - .await?; + self.localstore.remove_proofs(&input_ys, None).await?; } } } @@ -117,9 +111,7 @@ impl Mint { } None => { tracing::info!("Swap request with unknown keyset in outputs"); - self.localstore - .update_proofs_states(&input_ys, State::Unspent) - .await?; + self.localstore.remove_proofs(&input_ys, None).await?; } } } @@ -129,9 +121,7 @@ impl Mint { // now if keyset_units.len().gt(&1) { tracing::error!("Only one unit is allowed in request: {:?}", keyset_units); - self.localstore - .update_proofs_states(&input_ys, State::Unspent) - .await?; + self.localstore.remove_proofs(&input_ys, None).await?; return Err(Error::UnsupportedUnit); } @@ -146,9 +136,7 @@ impl Mint { for blinded_message in &swap_request.outputs { if let Err(err) = blinded_message.verify_p2pk(&pubkeys, sigs_required) { tracing::info!("Could not verify p2pk in swap request"); - self.localstore - .update_proofs_states(&input_ys, State::Unspent) - .await?; + self.localstore.remove_proofs(&input_ys, None).await?; return Err(err.into()); } }