@@ -16,7 +16,6 @@ use crate::logger::{log_error, LdkLogger, Logger};
1616use crate :: payment:: { bolt11:: maybe_wrap_invoice, Bolt11Payment , Bolt12Payment , OnchainPayment } ;
1717use crate :: Config ;
1818
19- use bitcoin:: script:: Instruction ;
2019use lightning:: ln:: channelmanager:: PaymentId ;
2120use lightning:: offers:: offer:: Offer ;
2221use lightning_invoice:: { Bolt11Invoice , Bolt11InvoiceDescription , Description } ;
@@ -94,14 +93,14 @@ impl UnifiedQrPayment {
9493
9594 let amount_msats = amount_sats * 1_000 ;
9695
97- // let bolt12_offer = match self.bolt12_payment.receive(amount_msats, description, None, None)
98- // {
99- // Ok(offer) => Some(offer),
100- // Err(e) => {
101- // log_error!(self.logger, "Failed to create offer: {}", e);
102- // return Err(Error::OfferCreationFailed);
103- // },
104- // };
96+ let bolt12_offer = match self . bolt12_payment . receive ( amount_msats, description, None , None )
97+ {
98+ Ok ( offer) => Some ( offer) ,
99+ Err ( e) => {
100+ log_error ! ( self . logger, "Failed to create offer: {}" , e) ;
101+ return Err ( Error :: OfferCreationFailed ) ;
102+ } ,
103+ } ;
105104
106105 let invoice_description = Bolt11InvoiceDescription :: Direct (
107106 Description :: new ( description. to_string ( ) ) . map_err ( |_| Error :: InvoiceCreationFailed ) ?,
@@ -163,7 +162,6 @@ impl UnifiedQrPayment {
163162 "Configurable amount payments not supported in this version"
164163 ) ;
165164 return Err ( Error :: InvalidUri ) ;
166- return Err ( Error :: InvalidAmount ) ;
167165 } ,
168166 PaymentInstructions :: FixedAmount ( instructions) => {
169167 for method in instructions. methods ( ) {
@@ -201,11 +199,11 @@ impl UnifiedQrPayment {
201199 } ,
202200 }
203201 }
202+
203+ log_error ! ( self . logger, "No payable methods found in URI" ) ;
204+ Err ( Error :: InvalidUri )
204205 } ,
205206 }
206-
207- log_error ! ( self . logger, "No valid payment method found in the URI." ) ;
208- Err ( Error :: InvalidUri )
209207 }
210208}
211209
0 commit comments