abci: add ResponseInitChain.app_hash, check and record it (#5227)

Fixes #5177.
This commit is contained in:
Erik Grinaker
2020-08-11 14:28:11 +00:00
committed by GitHub
parent 40bd416d59
commit 08ffe13295
5 changed files with 236 additions and 168 deletions
+8
View File
@@ -315,7 +315,15 @@ func (h *Handshaker) ReplayBlocks(
return nil, err
}
if !bytes.Equal(res.AppHash, h.genDoc.AppHash) {
return nil, fmt.Errorf(
"app hash from InitChain does not match genesis, got %X expected %X",
res.AppHash, h.genDoc.AppHash)
}
appHash = res.AppHash
if stateBlockHeight == 0 { //we only update state when we are in initial state
state.AppHash = res.AppHash
// If the app returned validators or consensus params, update the state.
if len(res.Validators) > 0 {
vals, err := types.PB2TM.ValidatorUpdates(res.Validators)