diff --git a/libs/gl-plugin/src/node/mod.rs b/libs/gl-plugin/src/node/mod.rs index f3e2e209f..0ac92c773 100644 --- a/libs/gl-plugin/src/node/mod.rs +++ b/libs/gl-plugin/src/node/mod.rs @@ -295,10 +295,12 @@ impl Node for PluginNodeServer { // In case the client did not specify an LSP to work with, // let's enumerate them, and select the best option ourselves. - let lsps = self.get_lsps_offers(&mut rpc).await.map_err(|_e| { + let mut lsps = self.get_lsps_offers(&mut rpc).await.map_err(|_e| { Status::not_found("Could not retrieve LSPS peers for invoice negotiation.") })?; + lsps.sort_by_key(|l| l.node_id.clone()); + if lsps.is_empty() { return Err(Status::not_found( "Could not find an LSP peer to negotiate the LSPS2 channel for this invoice.",