Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Dec 5, 2024
1 parent 8304c30 commit 0c28396
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sharechain/p2chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,11 @@ impl P2Chain {
self.levels.len() as u64 >= self.total_size + SAFETY_MARGIN + MAX_EXTRA_SYNC
}

fn cleanup_chain(&mut self) -> Result<(), ShareChainError>{
fn cleanup_chain(&mut self) -> Result<(), ShareChainError> {
let mut first_index = self.levels.back().map(|level| level.height).unwrap_or(0);
let mut current_chain_length = self.current_tip.saturating_sub(first_index);
// let see if we are the limit for the current chain
while current_chain_length > self.total_size + SAFETY_MARGIN{
while current_chain_length > self.total_size + SAFETY_MARGIN {
self.levels.pop_back().ok_or(ShareChainError::BlockLevelNotFound)?;
first_index = self.levels.back().map(|level| level.height).unwrap_or(0);
current_chain_length = self.current_tip.saturating_sub(first_index);
Expand Down

0 comments on commit 0c28396

Please sign in to comment.