state: avoid panics for marshaling errors (#8125)

This commit is contained in:
Sam Kleinman
2022-03-15 18:27:23 -04:00
committed by GitHub
parent 93c4e00e8e
commit 48b1952f18
5 changed files with 42 additions and 22 deletions

View File

@@ -23,9 +23,7 @@ import (
// order (highest first).
//
// More: https://docs.tendermint.com/master/rpc/#/Info/blockchain
func (env *Environment) BlockchainInfo(
ctx context.Context,
minHeight, maxHeight int64) (*coretypes.ResultBlockchainInfo, error) {
func (env *Environment) BlockchainInfo(ctx context.Context, minHeight, maxHeight int64) (*coretypes.ResultBlockchainInfo, error) {
const limit int64 = 20

View File

@@ -14,10 +14,7 @@ import (
// for the validators in the set as used in computing their Merkle root.
//
// More: https://docs.tendermint.com/master/rpc/#/Info/validators
func (env *Environment) Validators(
ctx context.Context,
heightPtr *int64,
pagePtr, perPagePtr *int) (*coretypes.ResultValidators, error) {
func (env *Environment) Validators(ctx context.Context, heightPtr *int64, pagePtr, perPagePtr *int) (*coretypes.ResultValidators, error) {
// The latest validator that we know is the NextValidator of the last block.
height, err := env.getHeight(env.latestUncommittedHeight(), heightPtr)
@@ -86,7 +83,8 @@ func (env *Environment) DumpConsensusState(ctx context.Context) (*coretypes.Resu
}
return &coretypes.ResultDumpConsensusState{
RoundState: roundState,
Peers: peerStates}, nil
Peers: peerStates,
}, nil
}
// ConsensusState returns a concise summary of the consensus state.