diff --git a/crates/cdk/src/mint/check_spendable.rs b/crates/cdk/src/mint/check_spendable.rs index 7527abea..3ac3ad34 100644 --- a/crates/cdk/src/mint/check_spendable.rs +++ b/crates/cdk/src/mint/check_spendable.rs @@ -57,6 +57,17 @@ impl Mint { return Err(Error::TokenAlreadySpent); } + for public_key in ys { + self.pubsub_manager.broadcast( + ProofState { + y: *public_key, + state: proof_state, + witness: None, + } + .into(), + ); + } + Ok(()) } } diff --git a/crates/cdk/src/mint/melt.rs b/crates/cdk/src/mint/melt.rs index 7a396d5a..6a73b179 100644 --- a/crates/cdk/src/mint/melt.rs +++ b/crates/cdk/src/mint/melt.rs @@ -16,9 +16,10 @@ use crate::{ Amount, Error, }; +use super::ProofState; use super::{ CurrencyUnit, MeltBolt11Request, MeltQuote, MeltQuoteBolt11Request, MeltQuoteBolt11Response, - Mint, NotificationPayload, PaymentMethod, PublicKey, State, + Mint, PaymentMethod, PublicKey, State, }; impl Mint { @@ -363,6 +364,17 @@ impl Mint { .melt_quote_status("e, None, None, MeltQuoteState::Unpaid); } + for public_key in input_ys { + self.pubsub_manager.broadcast( + ProofState { + y: public_key, + state: State::Unspent, + witness: None, + } + .into(), + ); + } + Ok(()) } @@ -607,6 +619,17 @@ impl Mint { MeltQuoteState::Paid, ); + for public_key in input_ys { + self.pubsub_manager.broadcast( + ProofState { + y: public_key, + state: State::Spent, + witness: None, + } + .into(), + ); + } + let mut change = None; // Check if there is change to return diff --git a/crates/cdk/src/mint/swap.rs b/crates/cdk/src/mint/swap.rs index 16a72afe..682a052f 100644 --- a/crates/cdk/src/mint/swap.rs +++ b/crates/cdk/src/mint/swap.rs @@ -6,7 +6,7 @@ use crate::nuts::nut00::ProofsMethods; use crate::Error; use super::nut11::{enforce_sig_flag, EnforceSigFlag}; -use super::{Id, Mint, PublicKey, SigFlag, State, SwapRequest, SwapResponse}; +use super::{Id, Mint, ProofState, PublicKey, SigFlag, State, SwapRequest, SwapResponse}; impl Mint { /// Process Swap @@ -166,6 +166,17 @@ impl Mint { .update_proofs_states(&input_ys, State::Spent) .await?; + for pub_key in input_ys { + self.pubsub_manager.broadcast( + ProofState { + y: pub_key, + state: State::Spent, + witness: None, + } + .into(), + ); + } + self.localstore .add_blind_signatures( &swap_request