Skip to content

Commit f6d9a36

Browse files
committed
Fix flashblocks index
1 parent 3560553 commit f6d9a36

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/state.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::{
55

66
#[derive(Debug)]
77
pub struct FlashblockNumber {
8-
/// Current flashblock number (1-indexed).
8+
/// Current flashblock number.
99
current_flashblock: AtomicU64,
1010
/// Number of flashblocks we're targeting to build for this block.
1111
target_flashblocks: AtomicU64,
@@ -14,7 +14,7 @@ pub struct FlashblockNumber {
1414
impl FlashblockNumber {
1515
pub fn new() -> Self {
1616
Self {
17-
current_flashblock: AtomicU64::new(1),
17+
current_flashblock: AtomicU64::new(0),
1818
target_flashblocks: AtomicU64::new(0),
1919
}
2020
}
@@ -33,7 +33,7 @@ impl FlashblockNumber {
3333

3434
pub fn in_bounds(&self) -> bool {
3535
self.current_flashblock.load(Ordering::Relaxed)
36-
<= self.target_flashblocks.load(Ordering::Relaxed)
36+
< self.target_flashblocks.load(Ordering::Relaxed)
3737
}
3838

3939
pub fn set_target_flashblocks(&self, target_flashblock: u64) {
@@ -43,7 +43,7 @@ impl FlashblockNumber {
4343
}
4444

4545
pub fn reset_current_flashblock(&self) -> u64 {
46-
self.current_flashblock.swap(1, Ordering::Relaxed)
46+
self.current_flashblock.swap(0, Ordering::Relaxed)
4747
}
4848
}
4949

0 commit comments

Comments
 (0)