Skip to content

Commit

Permalink
fix: timeUntilNext calculation before genesis (#7372)
Browse files Browse the repository at this point in the history
Fix timeUntilNext before genesis
  • Loading branch information
ensi321 authored Jan 17, 2025
1 parent 25e78f0 commit 06831cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/validator/src/util/clock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ export class Clock implements IClock {
if (msFromGenesis >= 0) {
return milliSecondsPerSlot - (msFromGenesis % milliSecondsPerSlot);
}
return Math.abs(msFromGenesis % milliSecondsPerSlot);
return Math.abs(msFromGenesis) % milliSecondsPerSlot;
}
const milliSecondsPerEpoch = SLOTS_PER_EPOCH * milliSecondsPerSlot;
if (msFromGenesis >= 0) {
return milliSecondsPerEpoch - (msFromGenesis % milliSecondsPerEpoch);
}
return Math.abs(msFromGenesis % milliSecondsPerEpoch);
return Math.abs(msFromGenesis) % milliSecondsPerEpoch;
}
}

Expand Down

0 comments on commit 06831cf

Please sign in to comment.