Browse Source

allow genesisTime IsZero -> now

pull/9/head
Jae Kwon 10 years ago
parent
commit
47caa47076
2 changed files with 7 additions and 1 deletions
  1. +3
    -1
      consensus/reactor.go
  2. +4
    -0
      state/genesis.go

+ 3
- 1
consensus/reactor.go View File

@ -293,7 +293,9 @@ func (conR *ConsensusReactor) stepTransitionRoutine() {
// when it is due. // when it is due.
scheduleNextAction := func() { scheduleNextAction := func() {
rs := conR.conS.GetRoundState() 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() { go func() {
switch rs.Step { switch rs.Step {
case RoundStepStart: case RoundStepStart:


+ 4
- 0
state/genesis.go 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 { func GenesisState(db db_.DB, genesisTime time.Time, accDets []*AccountDetail) *State {
if genesisTime.IsZero() {
genesisTime = time.Now()
}
// TODO: Use "uint64Codec" instead of BasicCodec // TODO: Use "uint64Codec" instead of BasicCodec
accountDetails := merkle.NewIAVLTree(BasicCodec, AccountDetailCodec, defaultAccountDetailsCacheCapacity, db) accountDetails := merkle.NewIAVLTree(BasicCodec, AccountDetailCodec, defaultAccountDetailsCacheCapacity, db)
validators := []*Validator{} validators := []*Validator{}


Loading…
Cancel
Save