Skip to content

Commit afa6457

Browse files
authored
fix visual bug on visualize_batch_state leading to a non-wanted comma (#8499)
Which issue # does this PR address? None The `visualize_batch_state`  functions uses the following loop `for mut batch_index in 0..BATCH_BUFFER_SIZE`, making it from `0` to `BATCH_BUFFER_SIZE - 1` (behind the scenes). Hence we would never hit the following condition: ```rust if batch_index != BATCH_BUFFER_SIZE { visualization_string.push(','); } ``` Replacing `!=` with `<` & `BATCH_BUFFER_SIZE -1` allows for the following change: `[A,B,C,D,E,]` to become: `[A,B,C,D,E]` Co-Authored-By: Antoine James <[email protected]>
1 parent ac8d773 commit afa6457

File tree

1 file changed

+1
-1
lines changed
  • beacon_node/network/src/sync/range_sync

1 file changed

+1
-1
lines changed

beacon_node/network/src/sync/range_sync/chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,7 @@ impl<T: BeaconChainTypes> SyncingChain<T> {
13311331
.get(&(self.processing_target + batch_index as u64 * EPOCHS_PER_BATCH))
13321332
{
13331333
visualization_string.push(batch.visualize());
1334-
if batch_index != BATCH_BUFFER_SIZE {
1334+
if batch_index < BATCH_BUFFER_SIZE - 1 {
13351335
// Add a comma in between elements
13361336
visualization_string.push(',');
13371337
}

0 commit comments

Comments
 (0)