Skip to content

Commit

Permalink
Trigger event for ProofState
Browse files Browse the repository at this point in the history
Ref[1]

[1] #394 (review)
  • Loading branch information
crodas committed Oct 28, 2024
1 parent d7f5791 commit 78a8b5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/cdk/src/mint/melt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{

use super::{
CurrencyUnit, MeltBolt11Request, MeltQuote, MeltQuoteBolt11Request, MeltQuoteBolt11Response,
Mint, NotificationPayload, PaymentMethod, PublicKey, State,
Mint, PaymentMethod, PublicKey, State,
};

impl Mint {
Expand Down
13 changes: 12 additions & 1 deletion crates/cdk/src/mint/swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 78a8b5d

Please sign in to comment.