Skip to content

Commit 3f2d379

Browse files
committed
Use new ChannelError in get_channel_announcement
1 parent ff644f4 commit 3f2d379

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/ln/channel.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,15 +2648,15 @@ impl Channel {
26482648
/// closing).
26492649
/// Note that the "channel must be funded" requirement is stricter than BOLT 7 requires - see
26502650
/// https://github.com/lightningnetwork/lightning-rfc/issues/468
2651-
pub fn get_channel_announcement(&self, our_node_id: PublicKey, chain_hash: Sha256dHash) -> Result<(msgs::UnsignedChannelAnnouncement, Signature), HandleError> {
2651+
pub fn get_channel_announcement(&self, our_node_id: PublicKey, chain_hash: Sha256dHash) -> Result<(msgs::UnsignedChannelAnnouncement, Signature), ChannelError> {
26522652
if !self.announce_publicly {
2653-
return Err(HandleError{err: "Channel is not available for public announcements", action: Some(msgs::ErrorAction::IgnoreError)});
2653+
return Err(ChannelError::Ignore("Channel is not available for public announcements"));
26542654
}
26552655
if self.channel_state & (ChannelState::ChannelFunded as u32) == 0 {
2656-
return Err(HandleError{err: "Cannot get a ChannelAnnouncement until the channel funding has been locked", action: Some(msgs::ErrorAction::IgnoreError)});
2656+
return Err(ChannelError::Ignore("Cannot get a ChannelAnnouncement until the channel funding has been locked"));
26572657
}
26582658
if (self.channel_state & (ChannelState::LocalShutdownSent as u32 | ChannelState::ShutdownComplete as u32)) != 0 {
2659-
return Err(HandleError{err: "Cannot get a ChannelAnnouncement once the channel is closing", action: Some(msgs::ErrorAction::IgnoreError)});
2659+
return Err(ChannelError::Ignore("Cannot get a ChannelAnnouncement once the channel is closing"));
26602660
}
26612661

26622662
let were_node_one = our_node_id.serialize()[..] < self.their_node_id.serialize()[..];

src/ln/channelmanager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,7 @@ impl ChannelManager {
19391939

19401940
let our_node_id = self.get_our_node_id();
19411941
let (announcement, our_bitcoin_sig) = chan.get_channel_announcement(our_node_id.clone(), self.genesis_hash.clone())
1942-
.map_err(|e| MsgHandleErrInternal::from_maybe_close(e))?;
1942+
.map_err(|e| MsgHandleErrInternal::from_chan_maybe_close(e, msg.channel_id))?;
19431943

19441944
let were_node_one = announcement.node_id_1 == our_node_id;
19451945
let msghash = Message::from_slice(&Sha256dHash::from_data(&announcement.encode()[..])[..]).unwrap();

0 commit comments

Comments
 (0)