From 47caa470769b0a3920b43bfa4460cada9b69c41e Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Fri, 24 Oct 2014 18:21:30 -0700 Subject: [PATCH] allow genesisTime IsZero -> now --- consensus/reactor.go | 4 +++- state/genesis.go | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/consensus/reactor.go b/consensus/reactor.go index b7129f45..6e9bf6cc 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -293,7 +293,9 @@ func (conR *ConsensusReactor) stepTransitionRoutine() { // when it is due. scheduleNextAction := func() { rs := conR.conS.GetRoundState() - _, _, roundDuration, _, elapsedRatio := calcRoundInfo(rs.StartTime) + round, roundStartTime, roundDuration, _, elapsedRatio := calcRoundInfo(rs.StartTime) + log.Debug("Called scheduleNextAction. round:%v roundStartTime:%v elapsedRatio:%v", + round, roundStartTime, elapsedRatio) go func() { switch rs.Step { case RoundStepStart: diff --git a/state/genesis.go b/state/genesis.go index e81106bb..417b2d85 100644 --- a/state/genesis.go +++ b/state/genesis.go @@ -39,6 +39,10 @@ func GenesisStateFromDoc(db db_.DB, genDoc *GenesisDoc) *State { func GenesisState(db db_.DB, genesisTime time.Time, accDets []*AccountDetail) *State { + if genesisTime.IsZero() { + genesisTime = time.Now() + } + // TODO: Use "uint64Codec" instead of BasicCodec accountDetails := merkle.NewIAVLTree(BasicCodec, AccountDetailCodec, defaultAccountDetailsCacheCapacity, db) validators := []*Validator{}