Skip to content

Commit adcac97

Browse files
committed
Avoid unwraping in get_announcement_sigs
While this is currently not reachable, it's still cleaner to avoid the `unwrap` and return `None` if `short_channel_id` hasn't been set yet.
1 parent 82fdf0f commit adcac97

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4900,11 +4900,16 @@ impl<Signer: WriteableEcdsaChannelSigner> Channel<Signer> {
49004900
},
49014901
Ok(v) => v
49024902
};
4903+
let short_channel_id = match self.context.get_short_channel_id() {
4904+
Some(scid) => scid,
4905+
None => return None,
4906+
};
4907+
49034908
self.context.announcement_sigs_state = AnnouncementSigsState::MessageSent;
49044909

49054910
Some(msgs::AnnouncementSignatures {
49064911
channel_id: self.context.channel_id(),
4907-
short_channel_id: self.context.get_short_channel_id().unwrap(),
4912+
short_channel_id,
49084913
node_signature: our_node_sig,
49094914
bitcoin_signature: our_bitcoin_sig,
49104915
})

0 commit comments

Comments
 (0)