allow genesisTime IsZero -> now

This commit is contained in:
Jae Kwon 2014-10-24 18:21:30 -07:00
parent 647d26f7a0
commit 47caa47076
2 changed files with 7 additions and 1 deletions

View File

@ -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:

View File

@ -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{}