Skip to content

Commit 070d816

Browse files
committed
f make logic more readable
1 parent b5efe05 commit 070d816

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lightning/src/ln/channelmanager.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -10221,18 +10221,19 @@ where
1022110221
// `channel_update`s for any channels less than a week old.
1022210222
let funding_conf_height =
1022310223
channel.context.get_funding_tx_confirmation_height().unwrap_or(height);
10224-
let mut should_announce = announcement_sigs.is_some() || funding_conf_height < height + 1008;
1022510224
// To avoid broadcast storms after each block, only
1022610225
// re-broadcast every hour (6 blocks) after the initial
1022710226
// broadcast, or if this is the first time we're ready to
1022810227
// broadcast this channel.
10229-
should_announce &= announcement_sigs.is_some() || funding_conf_height % 6 == height % 6;
10228+
let rebroadcast_announcement = funding_conf_height < height + 1008
10229+
&& funding_conf_height % 6 == height % 6;
10230+
let mut should_announce = announcement_sigs.is_some() || rebroadcast_announcement;
1023010231
// Most of our tests were written when we only broadcasted
1023110232
// `channel_announcement`s once and then never re-broadcasted
1023210233
// them again, so disable the re-broadcasting entirely in tests
1023310234
#[cfg(test)]
1023410235
{
10235-
should_announce &= announcement_sigs.is_some();
10236+
should_announce = announcement_sigs.is_some();
1023610237
}
1023710238
if should_announce {
1023810239
if let Some(announcement) = channel.get_signed_channel_announcement(

0 commit comments

Comments
 (0)