Skip to content

Commit

Permalink
Fix linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
muXxer committed Feb 15, 2024
1 parent 5769cdd commit a71b225
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions tools/genesis-snapshot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ func main() {
parsedOpts, configSelected := parseFlags()
opts := presets.Base
if strings.Contains(configSelected, ".yml") {
if yamlOpts, err := presets.GenerateFromYaml(configSelected); err != nil {
yamlOpts, err := presets.GenerateFromYaml(configSelected)
if err != nil {
panic(err)
} else {
opts = append(opts, yamlOpts...)
}
opts = append(opts, yamlOpts...)
} else {
switch configSelected {
case "docker":
Expand Down
6 changes: 3 additions & 3 deletions tools/genesis-snapshot/presets/presets.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ import (
)

var (
// use defaults from iota.go
// use defaults from iota.go.
protocolParamsBase = iotago.NewV3SnapshotProtocolParameters(
iotago.WithNetworkOptions("default", iotago.PrefixTestnet),
)

// use defaults from iota.go
// use defaults from iota.go.
protocolParamsDocker = iotago.NewV3SnapshotProtocolParameters(
iotago.WithNetworkOptions("docker", iotago.PrefixTestnet),
iotago.WithTimeProviderOptions(5, time.Now().Unix(), 10, 7),
iotago.WithLivenessOptions(10, 15, 3, 6, 8),
)

// use defaults from iota.go
// use defaults from iota.go.
protocolParamsFeature = iotago.NewV3SnapshotProtocolParameters(
iotago.WithNetworkOptions("feature", iotago.PrefixTestnet),
iotago.WithTimeProviderOptions(666666, time.Now().Unix()-100_000, 10, 13),
Expand Down
12 changes: 6 additions & 6 deletions tools/genesis-snapshot/presets/presets_yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import (

type ValidatorYaml struct {
Name string `yaml:"name"`
PublicKey string `yaml:"public-key"`
PublicKey string `yaml:"publicKey"`
}

type BlockIssuerYaml struct {
Name string `yaml:"name"`
PublicKey string `yaml:"public-key"`
PublicKey string `yaml:"publicKey"`
}

type BasicOutputYaml struct {
Expand All @@ -36,8 +36,8 @@ type ConfigYaml struct {
FilePath string `yaml:"filepath"`

Validators []ValidatorYaml `yaml:"validators"`
BlockIssuers []BlockIssuerYaml `yaml:"block-issuers"`
BasicOutputs []BasicOutputYaml `yaml:"basic-outputs"`
BlockIssuers []BlockIssuerYaml `yaml:"blockIssuers"`
BasicOutputs []BasicOutputYaml `yaml:"basicOutputs"`
}

func GenerateFromYaml(hostsFile string) ([]options.Option[snapshotcreator.Options], error) {
Expand All @@ -46,7 +46,7 @@ func GenerateFromYaml(hostsFile string) ([]options.Option[snapshotcreator.Option
return nil, err
}

var accounts []snapshotcreator.AccountDetails
accounts := make([]snapshotcreator.AccountDetails, 0, len(configYaml.Validators)+len(configYaml.BlockIssuers))
for _, validator := range configYaml.Validators {
pubkey := validator.PublicKey
fmt.Printf("adding validator %s with publicKey %s\n", validator.Name, pubkey)
Expand Down Expand Up @@ -80,7 +80,7 @@ func GenerateFromYaml(hostsFile string) ([]options.Option[snapshotcreator.Option
accounts = append(accounts, account)
}

var basicOutputs []snapshotcreator.BasicOutputDetails
basicOutputs := make([]snapshotcreator.BasicOutputDetails, 0, len(configYaml.BasicOutputs))
for _, basicOutput := range configYaml.BasicOutputs {
address := lo.Return2(iotago.ParseBech32(basicOutput.Address))
amount := basicOutput.Amount
Expand Down

0 comments on commit a71b225

Please sign in to comment.