Skip to content

Commit

Permalink
fix tests: use better function for waiting
Browse files Browse the repository at this point in the history
  • Loading branch information
algoidan committed Oct 23, 2022
1 parent fae555c commit 9ebdbce
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions stateproof/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1348,13 +1348,8 @@ func TestWorker_BuildersPersistenceAfterRestart(t *testing.T) {
proto := config.Consensus[protocol.ConsensusCurrentVersion]
s.advanceLatest((expectedStateproofs+1)*proto.StateProofInterval + proto.StateProofInterval/2) // 512, 768, 1024, ... (9 StateProofs)

// Wait on all signatures (should be many since they're re-broadcasted until the StateProof transaction is accepted)
for {
_, err := s.waitOnSigWithTimeout(time.Second * 2)
if err != nil {
break
}
}
err := waitForBuilderAndSignerToWaitOnRound(s)
a.NoError(err)

compareBuilders(a, expectedStateproofs, w, firstExpectedStateproof, proto)

Expand Down Expand Up @@ -1395,13 +1390,8 @@ func TestWorker_OnlySignaturesInDatabase(t *testing.T) {
proto := config.Consensus[protocol.ConsensusCurrentVersion]
s.advanceLatest((expectedStateproofs+1)*proto.StateProofInterval + proto.StateProofInterval/2) // 512, 768, 1024, ... (9 StateProofs)

// Wait on all signatures (should be many since they're re-broadcasted until the StateProof transaction is accepted)
for {
_, err := s.waitOnSigWithTimeout(time.Second * 2)
if err != nil {
break
}
}
err := waitForBuilderAndSignerToWaitOnRound(s)
a.NoError(err)

w.Shutdown()
dbs, _ = dbOpenTestRand(t, true, dbRand)
Expand Down

0 comments on commit 9ebdbce

Please sign in to comment.