Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kpandl committed Dec 17, 2024
1 parent 88d5574 commit 9f7c47f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions node/bft/src/sync/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ impl<N: Network> Sync<N> {
current_height += 1;
}
Err(e) => {
// Mark the current height as processed in block_sync.
// Mark the current height as processed in block_sync.
self.block_sync.remove_block_response(current_height);
return Err(e);
return Err(e);
}
}
}
Expand All @@ -347,7 +347,7 @@ impl<N: Network> Sync<N> {
current_height += 1;
}
Err(e) => {
// Mark the current height as processed in block_sync.
// Mark the current height as processed in block_sync.
self.block_sync.remove_block_response(current_height);
return Err(e);
}
Expand All @@ -372,7 +372,7 @@ impl<N: Network> Sync<N> {
self_.storage.sync_height_with_block(block.height());
// Sync the round with the block.
self_.storage.sync_round_with_block(block.round());
// Mark the block height as processed in block_sync.
// Mark the block height as processed in block_sync.
self_.block_sync.remove_block_response(block.height());

Ok(())
Expand Down Expand Up @@ -521,7 +521,7 @@ impl<N: Network> Sync<N> {
.await??;
// Remove the block height from the latest block responses.
latest_block_responses.remove(&block_height);
// Mark the block height as processed in block_sync.
// Mark the block height as processed in block_sync.
self.block_sync.remove_block_response(block_height);
}
} else {
Expand Down
9 changes: 5 additions & 4 deletions node/sync/src/block_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ impl<N: Network> BlockSync<N> {
let requests = self.requests.write();

// Determine if the request is complete.
let is_request_complete = requests.get(&next_height).map(|(_, _, peer_ips)| peer_ips.is_empty()).unwrap_or(true);
let is_request_complete =
requests.get(&next_height).map(|(_, _, peer_ips)| peer_ips.is_empty()).unwrap_or(true);

// If the request is not complete, return early.
if !is_request_complete {
Expand Down Expand Up @@ -369,7 +370,7 @@ impl<N: Network> BlockSync<N> {
warn!("Block height mismatch: expected {}, found {}", current_height + 1, block.height());
break;
}

// Try to check the next block and advance to it.
let advanced = match self.canon.check_next_block(&block) {
Ok(_) => match self.canon.advance_to_next_block(&block) {
Expand All @@ -384,10 +385,10 @@ impl<N: Network> BlockSync<N> {
false
}
};

// Remove the block response.
self.remove_block_response(current_height + 1);

// If advancing failed, exit the loop.
if !advanced {
break;
Expand Down

0 comments on commit 9f7c47f

Please sign in to comment.