From: Valentine Wallace Date: Wed, 22 Feb 2023 19:09:58 +0000 (-0500) Subject: Fix InvalidRoute error to be ChannelUnavailable X-Git-Tag: v0.0.114-beta~8^2~5 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=5e4f0bcff0cea5e4c0652c2ef3c86ddc19585e21;p=rust-lightning Fix InvalidRoute error to be ChannelUnavailable InvalidRoute is reserved for malformed routes, not routes where a channel or its peer is unavailable --- 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) {