diff --git a/src/lnurlp.rs b/src/lnurlp.rs index c8128b2..8aafee0 100644 --- a/src/lnurlp.rs +++ b/src/lnurlp.rs @@ -184,10 +184,16 @@ pub async fn verify( return Err(anyhow::anyhow!("NotFound")); } + let preimage = if invoice.state == InvoiceState::Settled as i32 { + Some(invoice.preimage) + } else { + None + }; + let verify_response = LnurlVerifyResponse { status: LnurlStatus::Ok, settled: invoice.state == InvoiceState::Settled as i32, - preimage: invoice.preimage, + preimage, pr: invoice.bolt11, }; diff --git a/src/routes.rs b/src/routes.rs index f9903b1..189a6c9 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -196,7 +196,7 @@ pub async fn lnurl_callback_route( pub struct LnurlVerifyResponse { pub status: LnurlStatus, pub settled: bool, - pub preimage: String, + pub preimage: Option, pub pr: String, }