Skip to content

Commit

Permalink
fix race during state sync test
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbuchwald committed Dec 29, 2024
1 parent d24e07d commit f8c4b97
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,9 @@ func TestStateSync(t *testing.T) {
// Note: could also stop producing blocks once we have produced a validity window of blocks
// after sync started.
stopCh := make(chan struct{})
stoppedCh := make(chan struct{})
go func() {
defer close(stoppedCh)
nonce := numBlocks + 1
for {
network.ConfirmBlocks(ctx, numBlocks, func(i int) []*chain.Transaction {
Expand Down Expand Up @@ -1152,6 +1154,7 @@ func TestStateSync(t *testing.T) {
case <-time.After(10 * time.Second):
r.FailNow("timed out waiting for state sync to finish")
}
<-stoppedCh

network.ConfirmBlocks(ctx, 1, func(int) []*chain.Transaction {
nonce++
Expand Down

0 comments on commit f8c4b97

Please sign in to comment.