mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-04 04:04:00 +00:00
node: allow orderly shutdown if context is canceled and gensis is in the future (#7817)
This commit is contained in:
@@ -441,7 +441,14 @@ func (n *nodeImpl) OnStart(ctx context.Context) error {
|
||||
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))
|
||||
|
||||
timer := time.NewTimer(genTime.Sub(now))
|
||||
defer timer.Stop()
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return ctx.Err()
|
||||
case <-timer.C:
|
||||
}
|
||||
}
|
||||
|
||||
// Start the RPC server before the P2P server
|
||||
|
||||
Reference in New Issue
Block a user