Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
feat: callback working, need to remove unwraps though
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodylow committed Jan 22, 2024
1 parent 6432319 commit 8bc1948
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/router/handlers/lnurlp/callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ pub(crate) async fn spawn_invoice_subscription(
subscription: UpdateStreamOrOutcome<LnReceiveState>,
) {
spawn("waiting for invoice being paid", async move {
let locked_clients = state.fm.clients.lock().await;
let client = locked_clients.get(&FederationId::from_str(&userrelays.federation_id).unwrap()).unwrap();
let nostr = state.nostr.clone();
let mut stream = subscription.into_stream();
while let Some(op_state) = stream.next().await {
match op_state {
Expand All @@ -207,7 +210,7 @@ pub(crate) async fn spawn_invoice_subscription(
let invoice = InvoiceBmc::set_state(&state.mm, id, InvoiceState::Settled)
.await
.expect("settling invoice can't fail");
notify_user(&state, id, invoice.amount as u64, userrelays.clone())
notify_user(client, &nostr, &state.mm, id, invoice.amount as u64, userrelays.clone())
.await
.expect("notifying user can't fail");
break;
Expand Down

0 comments on commit 8bc1948

Please sign in to comment.