File tree Expand file tree Collapse file tree 2 files changed +14
-25
lines changed Expand file tree Collapse file tree 2 files changed +14
-25
lines changed Original file line number Diff line number Diff line change @@ -511,19 +511,12 @@ where
511511 ) {
512512 Ok ( final_tx) => {
513513 let needs_manual_broadcast =
514- match self . liquidity_source . as_ref ( ) . map ( |ls| {
514+ self . liquidity_source . as_ref ( ) . map_or ( false , |ls| {
515515 ls. as_ref ( ) . lsps2_channel_needs_manual_broadcast (
516516 counterparty_node_id,
517517 user_channel_id,
518518 )
519- } ) {
520- Some ( Ok ( v) ) => v,
521- Some ( Err ( e) ) => {
522- log_error ! ( self . logger, "Failed to determine if channel needs manual broadcast: {:?}" , e) ;
523- false
524- } ,
525- None => false ,
526- } ;
519+ } ) ;
527520
528521 let result = if needs_manual_broadcast {
529522 self . liquidity_source . as_ref ( ) . map ( |ls| {
Original file line number Diff line number Diff line change @@ -310,22 +310,18 @@ where
310310
311311 pub ( crate ) fn lsps2_channel_needs_manual_broadcast (
312312 & self , counterparty_node_id : PublicKey , user_channel_id : u128 ,
313- ) -> Result < bool , APIError > {
314- // if we are not in a client_trusts_lsp model, we don't check and just return false
315- if !self . is_client_trusts_lsp ( ) {
316- log_debug ! ( self . logger, "Skipping funding transaction broadcast as client trusts LSP." ) ;
317- return Ok ( false ) ;
318- }
319-
320- // if we are in a client_trusts_lsp model, then we check if the LSP has an LSPS2 operation in progress
321- self . lsps2_service . as_ref ( ) . map_or ( Ok ( false ) , |_| {
322- let lsps2_service_handler = self . liquidity_manager . lsps2_service_handler ( ) ;
323- if let Some ( handler) = lsps2_service_handler {
324- handler. channel_needs_manual_broadcast ( user_channel_id, & counterparty_node_id)
325- } else {
326- log_error ! ( self . logger, "LSPS2 service handler is not available." ) ;
327- Ok ( false )
328- }
313+ ) -> bool {
314+ self . lsps2_service . as_ref ( ) . map_or ( false , |lsps2_service| {
315+ lsps2_service. service_config . client_trusts_lsp
316+ && self
317+ . liquidity_manager ( )
318+ . lsps2_service_handler ( )
319+ . and_then ( |handler| {
320+ handler
321+ . channel_needs_manual_broadcast ( user_channel_id, & counterparty_node_id)
322+ . ok ( )
323+ } )
324+ . unwrap_or ( false )
329325 } )
330326 }
331327
You can’t perform that action at this time.
0 commit comments