From de2cf2f6464804cf172e3c19edd03c6fbda2606f Mon Sep 17 00:00:00 2001 From: Alex71btc <105175715+Alex71btc@users.noreply.github.com> Date: Thu, 11 Jun 2026 20:48:59 +0200 Subject: [PATCH] fix: use InvoiceRequest::amount_msats() when creating invoices --- src/offers/client_impls.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/offers/client_impls.rs b/src/offers/client_impls.rs index 818d28b..47dbede 100644 --- a/src/offers/client_impls.rs +++ b/src/offers/client_impls.rs @@ -1,7 +1,6 @@ use lightning::blinded_path::payment::BlindedPaymentPath; use lightning::blinded_path::IntroductionNode; use lightning::offers::invoice_request::InvoiceRequest; -use lightning::offers::offer::Amount; use log::{error, trace}; use tonic::async_trait; use tonic_lnd::lnrpc::{ @@ -229,10 +228,11 @@ impl Bolt12InvoiceCreator for Client { &mut self, invoice_request: InvoiceRequest, ) -> Result { - let amount = match invoice_request.amount() { - Some(Amount::Bitcoin { amount_msats }) => amount_msats as i64, - _ => 0, - }; + // Use the request's amount (the payer's dynamic amount for amountless offers, or the + // offer amount times quantity for fixed-amount offers) rather than the offer's amount, + // which is None for amountless offers and would yield a 0-value invoice that LND cannot + // build blinded paths for. + let amount = invoice_request.amount_msats().unwrap_or(0) as i64; let description = match invoice_request.description() { Some(description) => description.to_string(), None => "".to_string(),