remove TimeIotaMs from ABCI consensus params (#3403)

Also

- init substructures to avoid panic in pb2tm.ConsensusParams
Before: if csp.Block is nil and we later try to access/write to it,
we'll panic.
After: if csp.Block is nil and we later try to access/write to it,
there'll be no panic.
This commit is contained in:
Anton Kaliaev
2019-03-11 22:21:17 +04:00
committed by GitHub
parent dc359bd3a5
commit 15f621141d
10 changed files with 209 additions and 252 deletions

View File

@@ -324,7 +324,12 @@ func (h *Handshaker) ReplayBlocks(
}
if res.ConsensusParams != nil {
state.ConsensusParams = types.PB2TM.ConsensusParams(res.ConsensusParams)
// Preserve TimeIotaMs since it's not exposed to the application.
timeIotaMs := state.ConsensusParams.Block.TimeIotaMs
{
state.ConsensusParams = types.PB2TM.ConsensusParams(res.ConsensusParams)
}
state.ConsensusParams.Block.TimeIotaMs = timeIotaMs
}
sm.SaveState(h.stateDB, state)
}