variadic WithSubsystems
This commit is contained in:
parent
42ae876711
commit
caa366bc6a
@ -31,14 +31,14 @@ func EnsembleWithMinerAndMarketNodes(t *testing.T, opts ...interface{}) (*TestFu
|
||||
main, market TestMiner
|
||||
)
|
||||
|
||||
mainNodeOpts := []NodeOpt{WithSubsystem(SSealing), WithSubsystem(SSectorStorage), WithSubsystem(SMining), DisableLibp2p()}
|
||||
mainNodeOpts := []NodeOpt{WithSubsystems(SSealing, SSectorStorage, SMining), DisableLibp2p()}
|
||||
mainNodeOpts = append(mainNodeOpts, nopts...)
|
||||
|
||||
blockTime := 100 * time.Millisecond
|
||||
ens := NewEnsemble(t, eopts...).FullNode(&fullnode, nopts...).Miner(&main, &fullnode, mainNodeOpts...).Start()
|
||||
ens.BeginMining(blockTime)
|
||||
|
||||
marketNodeOpts := []NodeOpt{OwnerAddr(fullnode.DefaultKey), MainMiner(&main), WithSubsystem(SStorageMarket)}
|
||||
marketNodeOpts := []NodeOpt{OwnerAddr(fullnode.DefaultKey), MainMiner(&main), WithSubsystems(SStorageMarket)}
|
||||
marketNodeOpts = append(marketNodeOpts, nopts...)
|
||||
|
||||
ens.Miner(&market, &fullnode, marketNodeOpts...).Start().Connect(market, fullnode)
|
||||
|
@ -58,9 +58,11 @@ func WithAllSubsystems() NodeOpt {
|
||||
}
|
||||
}
|
||||
|
||||
func WithSubsystem(single MinerSubsystem) NodeOpt {
|
||||
func WithSubsystems(systems ...MinerSubsystem) NodeOpt {
|
||||
return func(opts *nodeOpts) error {
|
||||
opts.subsystems = opts.subsystems.Add(single)
|
||||
for _, s := range systems {
|
||||
opts.subsystems = opts.subsystems.Add(s)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user