Re-sync some things with original patch

This commit is contained in:
Sergio Mena
2022-11-18 11:18:26 +01:00
parent f88a57e5a2
commit 1222d07178
2 changed files with 8 additions and 5 deletions

View File

@@ -552,7 +552,7 @@ func updateState(
return state, fmt.Errorf("updating consensus params: %w", err)
}
err = state.ConsensusParams.ValidateUpdate(&nextParams, header.Height)
err = state.ConsensusParams.ValidateUpdate(abciResponses.EndBlock.ConsensusParamUpdates, header.Height)
if err != nil {
return state, fmt.Errorf("updating consensus params: %w", err)
}

View File

@@ -194,14 +194,17 @@ func (params ConsensusParams) ValidateBasic() error {
return nil
}
func (params ConsensusParams) ValidateUpdate(updated *ConsensusParams, h int64) error {
if params.ABCI.VoteExtensionsEnableHeight == updated.ABCI.VoteExtensionsEnableHeight {
func (params ConsensusParams) ValidateUpdate(updated *tmproto.ConsensusParams, h int64) error {
if updated.Abci == nil {
return nil
}
if params.ABCI.VoteExtensionsEnableHeight != 0 && updated.ABCI.VoteExtensionsEnableHeight == 0 {
if params.ABCI.VoteExtensionsEnableHeight == updated.Abci.VoteExtensionsEnableHeight {
return nil
}
if params.ABCI.VoteExtensionsEnableHeight != 0 && updated.Abci.VoteExtensionsEnableHeight == 0 {
return errors.New("vote extensions cannot be disabled once enabled")
}
if updated.ABCI.VoteExtensionsEnableHeight <= h {
if updated.Abci.VoteExtensionsEnableHeight <= h {
return fmt.Errorf("VoteExtensionsEnableHeight cannot be updated to a past height, "+
"initial height: %d, current height %d",
params.ABCI.VoteExtensionsEnableHeight, h)