From ca1073bea11ae7cef893eb7756d6fd0f78bb9248 Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Wed, 10 Jan 2024 16:04:23 -0500 Subject: [PATCH] Fixed genesis height not being 0 --- core/engine.go | 4 ---- core/node.go | 2 +- main.go | 3 ++- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/core/engine.go b/core/engine.go index 376c77e..6fd5f18 100644 --- a/core/engine.go +++ b/core/engine.go @@ -22,10 +22,6 @@ type Engine struct { func NewEngine(genesisHeight, stopHeight uint64, rate int) Engine { blockRate := time.Minute / time.Duration(rate) - if genesisHeight == 0 { - genesisHeight = 1 - } - return Engine{ genesisHeight: genesisHeight, stopHeight: stopHeight, diff --git a/core/node.go b/core/node.go index 7e49ae7..9858b95 100644 --- a/core/node.go +++ b/core/node.go @@ -35,7 +35,7 @@ func NewNode( } func (node *Node) Initialize() error { - logrus.Info("initializing node") + logrus.WithField("genesis_height", node.store.genesisHeight).Info("initializing node") logrus.Info("initializing store") if err := node.store.Initialize(); err != nil { diff --git a/main.go b/main.go index bfb6a1c..6630461 100644 --- a/main.go +++ b/main.go @@ -70,6 +70,7 @@ func initLogger() error { } logrus.SetLevel(level) + logrus.SetOutput(os.Stderr) logrus.SetFormatter(&logrus.TextFormatter{FullTimestamp: true}) return nil @@ -81,7 +82,7 @@ func makeInitCommand() *cobra.Command { Short: "Initialize local blockchain state", SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { - logrus.WithField("dir", cliOpts.StoreDir).Info("initializing chain store") + logrus.WithField("dir", cliOpts.StoreDir).WithField("genesis_height", cliOpts.GenesisHeight).Info("initializing chain store") store := core.NewStore(cliOpts.StoreDir, cliOpts.GenesisHeight) return store.Initialize()