Delay starting node until Genesis time (#2389)

This commit is contained in:
Zarko Milosevic
2018-09-18 11:16:50 +02:00
committed by Anton Kaliaev
parent 64fc8f8157
commit 2fbf810cd8
3 changed files with 26 additions and 0 deletions

View File

@ -14,6 +14,8 @@ import (
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"
)
func TestNodeStartStop(t *testing.T) {
@ -75,3 +77,17 @@ func TestSplitAndTrimEmpty(t *testing.T) {
assert.Equal(t, tc.expected, splitAndTrimEmpty(tc.s, tc.sep, tc.cutset), "%s", tc.s)
}
}
func TestNodeDelayedStop(t *testing.T) {
config := cfg.ResetTestRoot("node_delayed_node_test")
now := tmtime.Now()
// create & start node
n, err := DefaultNewNode(config, log.TestingLogger())
n.GenesisDoc().GenesisTime = now.Add(5 * time.Second)
assert.NoError(t, err)
n.Start()
startTime := tmtime.Now()
assert.Equal(t, true, startTime.After(n.GenesisDoc().GenesisTime))
}