Skip to content

Commit

Permalink
validate genesis before using (#4719)
Browse files Browse the repository at this point in the history
Currently if run `fastnet` without specifying a `genesis-time`, will panic:
```
2023-07-18T10:02:33.246+0200	INFO	00000.defaultLogger	Looking for identity file at `/home/dd/post/data/key.bin`
panic: code should have run Validate before this method
```
  • Loading branch information
zhiqiangxu committed Jul 18, 2023
1 parent 1026cc1 commit c40a4ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ func GetCommand() *cobra.Command {
}
defer app.Unlock()

if err := app.Initialize(); err != nil {
return err
}

/* Create or load miner identity */
if app.edSgn, err = app.LoadOrCreateEdSigner(); err != nil {
return fmt.Errorf("could not retrieve identity: %w", err)
Expand All @@ -155,10 +159,6 @@ func GetCommand() *cobra.Command {
return err
}

if err := app.Initialize(); err != nil {
return err
}

// This blocks until the context is finished or until an error is produced
err = app.Start(ctx)

Expand Down

0 comments on commit c40a4ab

Please sign in to comment.