From 3f2d379835e5bb73c44c536786e228ff07dff9a0 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 30 Sep 2018 20:03:35 -0400 Subject: [PATCH] Use new ChannelError in get_channel_announcement --- src/ln/channel.rs | 8 ++++---- src/ln/channelmanager.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ln/channel.rs b/src/ln/channel.rs index fdddd2368..19c80f81e 100644 --- a/src/ln/channel.rs +++ b/src/ln/channel.rs @@ -2648,15 +2648,15 @@ impl Channel { /// closing). /// Note that the "channel must be funded" requirement is stricter than BOLT 7 requires - see /// https://github.com/lightningnetwork/lightning-rfc/issues/468 - pub fn get_channel_announcement(&self, our_node_id: PublicKey, chain_hash: Sha256dHash) -> Result<(msgs::UnsignedChannelAnnouncement, Signature), HandleError> { + pub fn get_channel_announcement(&self, our_node_id: PublicKey, chain_hash: Sha256dHash) -> Result<(msgs::UnsignedChannelAnnouncement, Signature), ChannelError> { if !self.announce_publicly { - return Err(HandleError{err: "Channel is not available for public announcements", action: Some(msgs::ErrorAction::IgnoreError)}); + return Err(ChannelError::Ignore("Channel is not available for public announcements")); } if self.channel_state & (ChannelState::ChannelFunded as u32) == 0 { - return Err(HandleError{err: "Cannot get a ChannelAnnouncement until the channel funding has been locked", action: Some(msgs::ErrorAction::IgnoreError)}); + return Err(ChannelError::Ignore("Cannot get a ChannelAnnouncement until the channel funding has been locked")); } if (self.channel_state & (ChannelState::LocalShutdownSent as u32 | ChannelState::ShutdownComplete as u32)) != 0 { - return Err(HandleError{err: "Cannot get a ChannelAnnouncement once the channel is closing", action: Some(msgs::ErrorAction::IgnoreError)}); + return Err(ChannelError::Ignore("Cannot get a ChannelAnnouncement once the channel is closing")); } let were_node_one = our_node_id.serialize()[..] < self.their_node_id.serialize()[..]; diff --git a/src/ln/channelmanager.rs b/src/ln/channelmanager.rs index a9b3dfcd8..42dcc6c77 100644 --- a/src/ln/channelmanager.rs +++ b/src/ln/channelmanager.rs @@ -1939,7 +1939,7 @@ impl ChannelManager { let our_node_id = self.get_our_node_id(); let (announcement, our_bitcoin_sig) = chan.get_channel_announcement(our_node_id.clone(), self.genesis_hash.clone()) - .map_err(|e| MsgHandleErrInternal::from_maybe_close(e))?; + .map_err(|e| MsgHandleErrInternal::from_chan_maybe_close(e, msg.channel_id))?; let were_node_one = announcement.node_id_1 == our_node_id; let msghash = Message::from_slice(&Sha256dHash::from_data(&announcement.encode()[..])[..]).unwrap(); -- 2.39.5