proto: deduplicate consensus params (#9287)

This commit is contained in:
Callum Waters
2022-08-22 10:50:21 +02:00
committed by GitHub
parent 0ca3a89c90
commit 2d8df1bd4e
29 changed files with 623 additions and 1164 deletions

View File

@@ -233,7 +233,7 @@ func (c *Client) ConsensusParams(ctx context.Context, height *int64) (*ctypes.Re
}
// Validate res.
if err := types.ValidateConsensusParams(res.ConsensusParams); err != nil {
if err := res.ConsensusParams.ValidateBasic(); err != nil {
return nil, err
}
if res.BlockHeight <= 0 {
@@ -247,7 +247,7 @@ func (c *Client) ConsensusParams(ctx context.Context, height *int64) (*ctypes.Re
}
// Verify hash.
if cH, tH := types.HashConsensusParams(res.ConsensusParams), l.ConsensusHash; !bytes.Equal(cH, tH) {
if cH, tH := res.ConsensusParams.Hash(), l.ConsensusHash; !bytes.Equal(cH, tH) {
return nil, fmt.Errorf("params hash %X does not match trusted hash %X",
cH, tH)
}