mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-14 13:51:21 +00:00
Delay starting node until Genesis time (#2389)
This commit is contained in:
committed by
Anton Kaliaev
parent
64fc8f8157
commit
2fbf810cd8
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
@ -37,6 +38,7 @@ import (
|
||||
"github.com/tendermint/tendermint/state/txindex/kv"
|
||||
"github.com/tendermint/tendermint/state/txindex/null"
|
||||
"github.com/tendermint/tendermint/types"
|
||||
tmtime "github.com/tendermint/tendermint/types/time"
|
||||
"github.com/tendermint/tendermint/version"
|
||||
|
||||
_ "net/http/pprof"
|
||||
@ -427,6 +429,13 @@ func NewNode(config *cfg.Config,
|
||||
|
||||
// OnStart starts the Node. It implements cmn.Service.
|
||||
func (n *Node) OnStart() error {
|
||||
now := tmtime.Now()
|
||||
genTime := n.genesisDoc.GenesisTime
|
||||
if genTime.After(now) {
|
||||
n.Logger.Info("Genesis time is in the future. Sleeping until then...", "genTime", genTime)
|
||||
time.Sleep(genTime.Sub(now))
|
||||
}
|
||||
|
||||
err := n.eventBus.Start()
|
||||
if err != nil {
|
||||
return err
|
||||
|
Reference in New Issue
Block a user