From: Matt Corallo Date: Thu, 1 Dec 2022 19:18:16 +0000 (+0000) Subject: Construct from-message `HTLCFailReason` via a constructor method X-Git-Tag: v0.0.113~13^2~8 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=4ba83381b12449dcdf14b0adc145290f55ebaf21;p=rust-lightning Construct from-message `HTLCFailReason` via a constructor method --- diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 3b1c9d54e..eddb5589e 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -309,6 +309,10 @@ impl HTLCFailReason { Self::Reason { failure_code, data: Vec::new() } } + pub(super) fn from_msg(msg: &msgs::UpdateFailHTLC) -> Self { + Self::LightningError { err: msg.reason.clone() } + } + fn get_encrypted_failure_packet(&self, incoming_packet_shared_secret: &[u8; 32], phantom_shared_secret: &Option<[u8; 32]>) -> msgs::OnionErrorPacket { match self { HTLCFailReason::Reason { ref failure_code, ref data } => { @@ -5125,7 +5129,7 @@ impl ChannelManager return Err(MsgHandleErrInternal::send_err_msg_no_close("Failed to find corresponding channel".to_owned(), msg.channel_id)) }