Skip to content

Commit

Permalink
Merge pull request #488 from iotaledger/fix/snapshot-genesis-seed
Browse files Browse the repository at this point in the history
Configure snapshot default genesis seed and fix fatal error
  • Loading branch information
karimodm authored Nov 3, 2023
2 parents 3b26f43 + 8226e8a commit c641e82
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tools/genesis-snapshot/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,20 @@ func main() {
func parseFlags() (opt []options.Option[snapshotcreator.Options], conf string) {
filename := flag.String("filename", "", "the name of the generated snapshot file")
config := flag.String("config", "", "use ready config: devnet, feature, docker")
genesisSeedStr := flag.String("seed", "", "the genesis seed provided in base58 format.")
genesisSeedStr := flag.String("seed", "7R1itJx5hVuo9w9hjg5cwKFmek4HMSoBDgJZN8hKGxih", "the genesis seed provided in base58 format.")

flag.Parse()
opt = []options.Option[snapshotcreator.Options]{}
if *filename != "" {
opt = append(opt, snapshotcreator.WithFilePath(*filename))
}

if *genesisSeedStr != "" {
genesisSeed, err := base58.Decode(*genesisSeedStr)
if err != nil {
log.Fatal(ierrors.Errorf("failed to decode base58 seed, using the default one: %w", err))
}
keyManager := mock.NewKeyManager(genesisSeed[:], 0)
opt = append(opt, snapshotcreator.WithGenesisKeyManager(keyManager))
genesisSeed, err := base58.Decode(*genesisSeedStr)
if err != nil {
log.Fatal(ierrors.Wrap(err, "failed to decode base58 seed"))
}
keyManager := mock.NewKeyManager(genesisSeed[:], 0)
opt = append(opt, snapshotcreator.WithGenesisKeyManager(keyManager))

return opt, *config
}

0 comments on commit c641e82

Please sign in to comment.