Explorar o código

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

Jing Yang %!s(int64=3) %!d(string=hai) anos
pai
achega
efbb23840c
Modificáronse 1 ficheiros con 3 adicións e 2 borrados
  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.