Skip to content

Commit

Permalink
feat: check for change in payment lookup id
Browse files Browse the repository at this point in the history
  • Loading branch information
thesimplekid committed Sep 24, 2024
1 parent 7203c69 commit 41a6e08
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions crates/cdk-axum/src/router_handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,23 @@ pub async fn post_melt_bolt11(
// Since it will not fail and even if it does the ln payment has already been paid, proofs should still be burned
let amount_spent = to_unit(pre.total_spent, &pre.unit, &quote.unit).unwrap_or_default();

let payment_lookup_id = pre.payment_lookup_id;

if payment_lookup_id != quote.request_lookup_id {
tracing::info!(
"Payment lookup id changed post payment from {} to {}",
quote.request_lookup_id,
payment_lookup_id
);

let mut melt_quote = quote;
melt_quote.request_lookup_id = payment_lookup_id;

if let Err(err) = state.mint.localstore.add_melt_quote(melt_quote).await {
tracing::warn!("Could not update payment lookup id: {}", err);
}
}

(pre.payment_preimage, amount_spent)
}
};
Expand Down

0 comments on commit 41a6e08

Please sign in to comment.