From: Valentine Wallace Date: Thu, 1 Dec 2022 05:12:29 +0000 (-0500) Subject: Clean up HTLC intercept errors X-Git-Tag: v0.0.113~19^2~4 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=6791d2c30725832214ed374197cd1c328fd954db;p=rust-lightning Clean up HTLC intercept errors ChannelUnavailable is a better fit for errors regarding unavailable channels than APIMisuseError. Also log bytes in errors as hex instead of decimal. --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 20014f799..35b240e40 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -3080,20 +3080,20 @@ impl ChannelManager { if !chan.is_usable() { - return Err(APIError::APIMisuseError { - err: format!("Channel with id {:?} not fully established", next_hop_channel_id) + return Err(APIError::ChannelUnavailable { + err: format!("Channel with id {} not fully established", log_bytes!(*next_hop_channel_id)) }) } chan.get_short_channel_id().unwrap_or(chan.outbound_scid_alias()) }, - None => return Err(APIError::APIMisuseError { - err: format!("Channel with id {:?} not found", next_hop_channel_id) + None => return Err(APIError::ChannelUnavailable { + err: format!("Channel with id {} not found", log_bytes!(*next_hop_channel_id)) }) }; let payment = self.pending_intercepted_htlcs.lock().unwrap().remove(&intercept_id) .ok_or_else(|| APIError::APIMisuseError { - err: format!("Payment with intercept id {:?} not found", intercept_id.0) + err: format!("Payment with intercept id {} not found", log_bytes!(intercept_id.0)) })?; let routing = match payment.forward_info.routing { @@ -3128,7 +3128,7 @@ impl ChannelManager