Skip to content

Commit

Permalink
Fixed tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Frozen committed Nov 27, 2024
1 parent 2b55bac commit 37e81e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion consensus/quorum/quorom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ func TestCIdentities_NthNextValidatorFailedEdgeCase2(t *testing.T) {
case <-done:
t.Error("Expected a timeout, but successfully calculated next leader")

case <-time.After(5 * time.Second):
case <-time.After(1 * time.Second):
t.Log("Test timed out, possible infinite loop")
}
}
Expand Down
3 changes: 1 addition & 2 deletions consensus/quorum/quorum.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (s *cIdentities) NthNextValidator(slotList shard.SlotList, pubKey *bls.Publ
Str("key", pubKey.Bytes.Hex()).
Msg("[NthNextHmy] pubKey not found")
}
for i := 0; i < len(slotList); i++ {
for {
numNodes := len(s.publicKeys)
idx = (idx + next) % numNodes
if publicToAddress[s.publicKeys[idx].Bytes] == publicToAddress[pubKey.Bytes] {
Expand All @@ -290,7 +290,6 @@ func (s *cIdentities) NthNextValidator(slotList shard.SlotList, pubKey *bls.Publ
}
return found, &s.publicKeys[idx]
}
return false, pubKey
}

func (s *cIdentities) NthNextHmy(instance shardingconfig.Instance, pubKey *bls.PublicKeyWrapper, next int) (bool, *bls.PublicKeyWrapper) {
Expand Down

0 comments on commit 37e81e1

Please sign in to comment.