@@ -458,7 +458,7 @@ where
458458 runtime : Arc < Runtime > ,
459459 logger : L ,
460460 config : Arc < Config > ,
461- static_invoice_store : StaticInvoiceStore ,
461+ static_invoice_store : Option < StaticInvoiceStore > ,
462462}
463463
464464impl < L : Deref + Clone + Sync + Send + ' static > EventHandler < L >
@@ -472,7 +472,7 @@ where
472472 output_sweeper : Arc < Sweeper > , network_graph : Arc < Graph > ,
473473 liquidity_source : Option < Arc < LiquiditySource < Arc < Logger > > > > ,
474474 payment_store : Arc < PaymentStore > , peer_store : Arc < PeerStore < L > > ,
475- static_invoice_store : StaticInvoiceStore , runtime : Arc < Runtime > , logger : L ,
475+ static_invoice_store : Option < StaticInvoiceStore > , runtime : Arc < Runtime > , logger : L ,
476476 config : Arc < Config > ,
477477 ) -> Self {
478478 Self {
@@ -1504,37 +1504,38 @@ where
15041504 recipient_id,
15051505 invoice_persisted_path,
15061506 } => {
1507- match self
1508- . static_invoice_store
1509- . handle_persist_static_invoice ( invoice, invoice_slot, recipient_id)
1510- . await
1511- {
1512- Ok ( _) => { } ,
1513- Err ( e) => {
1514- log_error ! ( self . logger, "Failed to persist static invoice: {}" , e) ;
1515- } ,
1516- } ;
1507+ if let Some ( store ) = self . static_invoice_store . as_ref ( ) {
1508+ match store
1509+ . handle_persist_static_invoice ( invoice, invoice_slot, recipient_id)
1510+ . await
1511+ {
1512+ Ok ( _) => { } ,
1513+ Err ( e) => {
1514+ log_error ! ( self . logger, "Failed to persist static invoice: {}" , e) ;
1515+ } ,
1516+ } ;
15171517
1518- self . channel_manager . static_invoice_persisted ( invoice_persisted_path) ;
1518+ self . channel_manager . static_invoice_persisted ( invoice_persisted_path) ;
1519+ }
15191520 } ,
15201521 LdkEvent :: StaticInvoiceRequested { recipient_id, invoice_slot, reply_path } => {
1521- let invoice = self
1522- . static_invoice_store
1523- . handle_static_invoice_requested ( & recipient_id, invoice_slot)
1524- . await ;
1525-
1526- match invoice {
1527- Ok ( Some ( invoice ) ) => {
1528- if let Err ( e ) =
1529- self . channel_manager . send_static_invoice ( invoice , reply_path )
1530- {
1531- log_error ! ( self . logger , "Failed to send static invoice: {:?}" , e ) ;
1532- }
1533- } ,
1534- Ok ( None ) => { } ,
1535- Err ( e ) => {
1536- log_error ! ( self . logger , "Failed to retrieve static invoice: {}" , e ) ;
1537- } ,
1522+ if let Some ( store ) = self . static_invoice_store . as_ref ( ) {
1523+ let invoice =
1524+ store . handle_static_invoice_requested ( & recipient_id, invoice_slot) . await ;
1525+
1526+ match invoice {
1527+ Ok ( Some ( invoice) ) => {
1528+ if let Err ( e ) =
1529+ self . channel_manager . send_static_invoice ( invoice , reply_path )
1530+ {
1531+ log_error ! ( self . logger , "Failed to send static invoice: {:?}" , e ) ;
1532+ }
1533+ } ,
1534+ Ok ( None ) => { } ,
1535+ Err ( e ) => {
1536+ log_error ! ( self . logger , "Failed to retrieve static invoice: {}" , e ) ;
1537+ } ,
1538+ }
15381539 }
15391540 } ,
15401541 LdkEvent :: FundingTransactionReadyForSigning { .. } => {
0 commit comments