@@ -115,23 +115,24 @@ async fn main() {
115115 ) ;
116116 } ,
117117 Commands :: Bolt11Receive { description, description_hash, expiry_secs, amount_msat } => {
118- let description_result = match ( description, description_hash) {
119- ( Some ( description) , None ) => Ok ( Some ( Bolt11InvoiceDescription {
120- kind : Some ( bolt11_invoice_description:: Kind :: Direct ( description) ) ,
121- } ) ) ,
122- ( None , Some ( description_hash) ) => Ok ( Some ( Bolt11InvoiceDescription {
123- kind : Some ( bolt11_invoice_description:: Kind :: Hash ( description_hash) ) ,
124- } ) ) ,
125- ( Some ( _) , Some ( _) ) => Err ( LdkServerError :: InternalError (
126- "Only one of description or description_hash can be set." . to_string ( ) ,
127- ) ) ,
128- ( None , None ) => Ok ( None ) ,
129- } ;
130- let request = Bolt11ReceiveRequest {
131- description : description_result. unwrap_or_else ( |e| handle_error ( e) ) ,
132- expiry_secs,
133- amount_msat,
118+ let invoice_description = match ( description, description_hash) {
119+ ( Some ( desc) , None ) => Some ( Bolt11InvoiceDescription {
120+ kind : Some ( bolt11_invoice_description:: Kind :: Direct ( desc) ) ,
121+ } ) ,
122+ ( None , Some ( hash) ) => Some ( Bolt11InvoiceDescription {
123+ kind : Some ( bolt11_invoice_description:: Kind :: Hash ( hash) ) ,
124+ } ) ,
125+ ( Some ( _) , Some ( _) ) => {
126+ handle_error ( LdkServerError :: InternalError (
127+ "Only one of description or description_hash can be set." . to_string ( ) ,
128+ ) ) ;
129+ } ,
130+ ( None , None ) => None ,
134131 } ;
132+
133+ let request =
134+ Bolt11ReceiveRequest { description : invoice_description, expiry_secs, amount_msat } ;
135+
135136 handle_response_result ( client. bolt11_receive ( request) . await ) ;
136137 } ,
137138 Commands :: Bolt11Send { invoice, amount_msat } => {
0 commit comments