File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
lightning/src/onion_message Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ where
350
350
const MIN_PEER_CHANNELS : usize = 3 ;
351
351
352
352
let network_graph = self . network_graph . deref ( ) . read_only ( ) ;
353
- peers. into_iter ( )
353
+ let paths = peers. into_iter ( )
354
354
// Limit to peers with announced channels
355
355
. filter ( |pubkey|
356
356
network_graph
@@ -362,7 +362,15 @@ where
362
362
. map ( |pubkey| vec ! [ pubkey, recipient] )
363
363
. map ( |node_pks| BlindedPath :: new_for_message ( & node_pks, entropy_source, secp_ctx) )
364
364
. take ( MAX_PATHS )
365
- . collect ( )
365
+ . collect :: < Result < Vec < _ > , _ > > ( ) ;
366
+
367
+ match paths {
368
+ Ok ( paths) if !paths. is_empty ( ) => Ok ( paths) ,
369
+ _ => {
370
+ BlindedPath :: one_hop_for_message ( recipient, entropy_source, secp_ctx)
371
+ . map ( |path| vec ! [ path] )
372
+ } ,
373
+ }
366
374
}
367
375
}
368
376
You can’t perform that action at this time.
0 commit comments