From 5e4f0bcff0cea5e4c0652c2ef3c86ddc19585e21 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Wed, 22 Feb 2023 14:09:58 -0500 Subject: [PATCH] Fix InvalidRoute error to be ChannelUnavailable InvalidRoute is reserved for malformed routes, not routes where a channel or its peer is unavailable --- lightning/src/ln/channelmanager.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index ad942d25d..39cb9a7b5 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -2386,7 +2386,7 @@ where let per_peer_state = self.per_peer_state.read().unwrap(); let peer_state_mutex = per_peer_state.get(&counterparty_node_id) - .ok_or_else(|| APIError::InvalidRoute{err: "No peer matching the path's first hop found!" })?; + .ok_or_else(|| APIError::ChannelUnavailable{err: "No peer matching the path's first hop found!".to_owned() })?; let mut peer_state_lock = peer_state_mutex.lock().unwrap(); let peer_state = &mut *peer_state_lock; if let hash_map::Entry::Occupied(mut chan) = peer_state.channel_by_id.entry(id) { -- 2.39.5