浏览代码

timekeeper: restore 0 check for `slot`

y 2 年之前
父节点
当前提交
63a6856ccd
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/util/time.rs

+ 3 - 0
src/util/time.rs

@@ -78,6 +78,9 @@ impl TimeKeeper {
     /// epoch 1 has one less slot(the genesis slot) and
     /// rest epoch have the normal amount of slots.
     pub fn slot_epoch(&self, slot: u64) -> u64 {
+        if slot == 0 {
+            return 0
+        }
         (slot / self.epoch_length) + 1
     }