Skip to content

Commit

Permalink
fix: Get Devnet ID after the Thor flags are set (#915)
Browse files Browse the repository at this point in the history
* first commit

* using bytes32 method
  • Loading branch information
freemanzMrojo authored Dec 10, 2024
1 parent c74bbf0 commit ea74899
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cmd/thor/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import (
"gopkg.in/urfave/cli.v1"
)

var devNetGenesisID = genesis.NewDevnet().ID()
var devNetGenesisID thor.Bytes32

func initLogger(lvl int, jsonLogs bool) *slog.LevelVar {
logLevel := log.FromLegacyLevel(lvl)
Expand Down Expand Up @@ -632,6 +632,13 @@ func printStartupMessage1(
)
}

func getOrCreateDevnetID() thor.Bytes32 {
if devNetGenesisID.IsZero() {
devNetGenesisID = genesis.NewDevnet().ID()
}
return devNetGenesisID
}

func printStartupMessage2(
gene *genesis.Genesis,
apiURL string,
Expand Down Expand Up @@ -670,7 +677,7 @@ func printStartupMessage2(
}(),
func() string {
// print default dev net's dev accounts info
if gene.ID() == devNetGenesisID {
if gene.ID() == getOrCreateDevnetID() {
return `
┌──────────────────┬───────────────────────────────────────────────────────────────────────────────┐
│ Mnemonic Words │ denial kitchen pet squirrel other broom bar gas better priority spoil cross │
Expand Down

0 comments on commit ea74899

Please sign in to comment.