This commit is contained in:
Anton Evangelatov 2020-06-29 17:10:31 +02:00
parent 222d718ccd
commit c4347c0485
2 changed files with 6 additions and 5 deletions

View File

@ -3,7 +3,6 @@ package main
import ( import (
"context" "context"
"fmt" "fmt"
"math/rand"
"time" "time"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -54,15 +53,15 @@ func runMiner(t *TestEnvironment) error {
stateMineNext := sync.State(fmt.Sprintf("mine-block-%d", i)) stateMineNext := sync.State(fmt.Sprintf("mine-block-%d", i))
t.SyncClient.MustSignalAndWait(ctx, stateMineNext, miners) t.SyncClient.MustSignalAndWait(ctx, stateMineNext, miners)
// add some random delay to encourage a different miner winning each round ch := make(chan struct{})
time.Sleep(time.Duration(100 + rand.Intn(int(100*time.Millisecond))))
err := miner.MineOne(ctx, func(mined bool) { err := miner.MineOne(ctx, func(mined bool) {
t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1) t.D().Counter(fmt.Sprintf("block.mine,miner=%s", myActorAddr)).Inc(1)
close(ch)
}) })
if err != nil { if err != nil {
panic(err) panic(err)
} }
<-ch
} }
// signal the last block to make sure no miners are left stuck waiting for the next block signal // signal the last block to make sure no miners are left stuck waiting for the next block signal
@ -81,6 +80,8 @@ func runMiner(t *TestEnvironment) error {
t.RecordMessage("shutting down mining") t.RecordMessage("shutting down mining")
<-done <-done
time.Sleep(3600 * time.Second)
t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount) t.SyncClient.MustSignalAndWait(ctx, stateDone, t.TestInstanceCount)
return nil return nil
} }

View File

@ -20,7 +20,7 @@
miners = "3" miners = "3"
genesis_timestamp_offset = "100000" genesis_timestamp_offset = "100000"
balance = "2000" balance = "2000"
sectors = "10" sectors = "20"
[[groups]] [[groups]]
id = "bootstrapper" id = "bootstrapper"