mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-06 21:36:26 +00:00
consensus: don't check InitChain app hash vs genesis app hash, replace it (#5237)
Followup from #5227. Instead of checking `ResponseInitChain.app_hash` against the genesis doc app hash, we instead replace it. We should probably remove the genesis doc app hash completely, and rely solely on the one from `InitChain`, I'll open a separate issue to discuss this.
This commit is contained in:
@@ -323,15 +323,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 did not return an app hash, we keep the one set from the genesis doc in
|
||||
// the state. We don't set appHash since we don't want the genesis doc app hash
|
||||
// recorded in the genesis block. We should probably just remove GenesisDoc.AppHash.
|
||||
if len(res.AppHash) > 0 {
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user