Skip to content

Commit 72d85ab

Browse files
committed
fix zero situation
1 parent 86d2474 commit 72d85ab

2 files changed

Lines changed: 9 additions & 36 deletions

File tree

generator/generator.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package generator
33
import (
44
"errors"
55
"fmt"
6+
"log"
67
"sync"
78

89
"github.com/ethereum/go-ethereum/common"
@@ -166,13 +167,21 @@ func (g *configBasedGenerator) createWeightedGenerator() (Generator, error) {
166167
// Create weighted configurations
167168
var weightedConfigs []*WeightedCfg
168169
for _, instance := range g.instances {
170+
if instance.Weight == 0 {
171+
log.Printf("Skipping scenario %s with weight 0", instance.Name)
172+
continue
173+
}
169174
// Create a scenarioGenerator for this scenario instance
170175
gen := NewScenarioGenerator(instance.Accounts, instance.Scenario)
171176

172177
// Add to weighted config with the specified weight
173178
weightedConfigs = append(weightedConfigs, WeightedConfig(instance.Weight, gen))
174179
}
175180

181+
if len(weightedConfigs) == 0 {
182+
return nil, fmt.Errorf("no scenario instances created (define some scenarios)")
183+
}
184+
176185
// Create and return the weighted scenarioGenerator
177186
return NewWeightedGenerator(weightedConfigs...), nil
178187
}

profiles/combo.json

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)