From ea748996aae623bd2bc8faa630e108b9caedfd2c Mon Sep 17 00:00:00 2001 From: Miguel Angel Rojo Date: Tue, 10 Dec 2024 09:30:54 +0000 Subject: [PATCH] fix: Get Devnet ID after the Thor flags are set (#915) * first commit * using bytes32 method --- cmd/thor/utils.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cmd/thor/utils.go b/cmd/thor/utils.go index 59c5ec284..d53935c10 100644 --- a/cmd/thor/utils.go +++ b/cmd/thor/utils.go @@ -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) @@ -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, @@ -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 │