소스 검색

Move the covered index relative to start, instead of as an absolute index.

Jing Yang 3 년 전
부모
커밋
efbb23840c
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      src/verify_authority.rs

+ 3 - 2
src/verify_authority.rs

@@ -229,8 +229,9 @@ impl VerifyAuthorityDaemon {
             let first_not_ticked_index = state.queue.partition_point(|token| {
                 token.beats_moment[peer_index] <= ticked
             });
-            assert!(first_not_ticked_index >= state.covered[peer_index].0);
-            state.covered[peer_index].0 = first_not_ticked_index;
+            let new_covered = first_not_ticked_index + state.start.0;
+            assert!(new_covered >= state.covered[peer_index].0);
+            state.covered[peer_index].0 = new_covered;
 
             // Count the requests that has more than N / 2 votes. We always have
             // the vote from ourselves, but the value is 0 in `covered` array.