Skip to content

Commit 06831cf

Browse files
authored
fix: timeUntilNext calculation before genesis (#7372)
Fix timeUntilNext before genesis
1 parent 25e78f0 commit 06831cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/validator/src/util/clock.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ export class Clock implements IClock {
120120
if (msFromGenesis >= 0) {
121121
return milliSecondsPerSlot - (msFromGenesis % milliSecondsPerSlot);
122122
}
123-
return Math.abs(msFromGenesis % milliSecondsPerSlot);
123+
return Math.abs(msFromGenesis) % milliSecondsPerSlot;
124124
}
125125
const milliSecondsPerEpoch = SLOTS_PER_EPOCH * milliSecondsPerSlot;
126126
if (msFromGenesis >= 0) {
127127
return milliSecondsPerEpoch - (msFromGenesis % milliSecondsPerEpoch);
128128
}
129-
return Math.abs(msFromGenesis % milliSecondsPerEpoch);
129+
return Math.abs(msFromGenesis) % milliSecondsPerEpoch;
130130
}
131131
}
132132

0 commit comments

Comments
 (0)