Skip to content

Commit ad07970

Browse files
authored
Merge pull request #103 from andrei-21/feature/wait-for-two-channel-updates
Require two channel updates
2 parents 1ef1e32 + 90e6e4a commit ad07970

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/tracking.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ pub(crate) async fn download_gossip<L: Deref + Clone + Send + Sync + 'static>(pe
118118

119119
let was_previously_caught_up_with_gossip = is_caught_up_with_gossip;
120120
// TODO: make new message threshold (20) adjust based on connected peer count
121-
is_caught_up_with_gossip = new_message_count < 20 && previous_announcement_count > 0 && previous_update_count > 0;
121+
// There must be two channel updates (one for each end) to generate
122+
// a snapshot with information about the channel.
123+
is_caught_up_with_gossip = new_message_count < 20 && previous_announcement_count > 0 && previous_update_count > 0 && counter.channel_updates > 1;
124+
122125
if new_message_count > 0 {
123126
latest_new_gossip_time = Instant::now();
124127
}

0 commit comments

Comments
 (0)