Skip to content

Commit

Permalink
Make sync state more stable
Browse files Browse the repository at this point in the history
  • Loading branch information
bayk committed Dec 4, 2024
1 parent 2aa6375 commit ab11dc0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion chain/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,15 @@ impl SyncState {
/// Whether the current state matches any active syncing operation.
/// Note: This includes our "initial" state.
pub fn is_syncing(&self) -> bool {
*self.current.read() != SyncStatus::NoSync
match *self.current.read() {
SyncStatus::NoSync => false,
SyncStatus::BodySync {
archive_height: _,
current_height,
highest_height,
} => current_height + 10 < highest_height,
_ => false,
}
}

/// Current syncing status
Expand Down
2 changes: 1 addition & 1 deletion servers/src/mwc/sync/syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl SyncRunner {
.set_boost_peers_capabilities(sync_reponse.peers_capabilities);
}
SyncRequestResponses::Syncing => {
debug_assert!(self.sync_state.is_syncing());
//debug_assert!(self.sync_state.is_syncing());
self.peers
.set_boost_peers_capabilities(sync_reponse.peers_capabilities);
}
Expand Down

0 comments on commit ab11dc0

Please sign in to comment.