fix(lotus-sim): refuse to start simulation with no miners

This commit is contained in:
Steven Allen 2021-06-10 12:32:52 -07:00
parent d551f2b4bd
commit 707b3bf08a

View File

@ -6,6 +6,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -125,6 +126,10 @@ func loadSimulationState(ctx context.Context, sim *Simulation) (*simulationState
sealList = append(sealList, onboardingInfo{addr, uint64(sectorsAdded)}) sealList = append(sealList, onboardingInfo{addr, uint64(sectorsAdded)})
} }
} }
if len(sealList) == 0 {
return nil, xerrors.Errorf("simulation has no miners")
}
// We're already done loading for the _next_ epoch. // We're already done loading for the _next_ epoch.
// Next time, we need to load for the next, next epoch. // Next time, we need to load for the next, next epoch.
// TODO: fix this insanity. // TODO: fix this insanity.