mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-08 14:21:14 +00:00
BREAKING
Example response:
```json
{
"jsonrpc": "2.0",
"id": "",
"result": {
"height": "2109",
"txs_results": null,
"begin_block_events": null,
"end_block_events": null,
"validator_updates": null,
"consensus_param_updates": null
}
}
```
Old result consisted of ABCIResponses struct and height. Exposing
internal ABCI structures (which we store in state package) in RPC seems
bad to me for the following reasons:
1) high risk of breaking the API when somebody changes internal structs
(HAPPENED HERE!)
2) RPC is aware of ABCI, which I'm not sure we want
57 lines
2.2 KiB
Go
57 lines
2.2 KiB
Go
package state
|
|
|
|
import (
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
"github.com/tendermint/tendermint/types"
|
|
dbm "github.com/tendermint/tm-db"
|
|
)
|
|
|
|
//
|
|
// TODO: Remove dependence on all entities exported from this file.
|
|
//
|
|
// Every entity exported here is dependent on a private entity from the `state`
|
|
// package. Currently, these functions are only made available to tests in the
|
|
// `state_test` package, but we should not be relying on them for our testing.
|
|
// Instead, we should be exclusively relying on exported entities for our
|
|
// testing, and should be refactoring exported entities to make them more
|
|
// easily testable from outside of the package.
|
|
//
|
|
|
|
const ValSetCheckpointInterval = valSetCheckpointInterval
|
|
|
|
// UpdateState is an alias for updateState exported from execution.go,
|
|
// exclusively and explicitly for testing.
|
|
func UpdateState(
|
|
state State,
|
|
blockID types.BlockID,
|
|
header *types.Header,
|
|
abciResponses *ABCIResponses,
|
|
validatorUpdates []*types.Validator,
|
|
) (State, error) {
|
|
return updateState(state, blockID, header, abciResponses, validatorUpdates)
|
|
}
|
|
|
|
// ValidateValidatorUpdates is an alias for validateValidatorUpdates exported
|
|
// from execution.go, exclusively and explicitly for testing.
|
|
func ValidateValidatorUpdates(abciUpdates []abci.ValidatorUpdate, params types.ValidatorParams) error {
|
|
return validateValidatorUpdates(abciUpdates, params)
|
|
}
|
|
|
|
// CalcValidatorsKey is an alias for the private calcValidatorsKey method in
|
|
// store.go, exported exclusively and explicitly for testing.
|
|
func CalcValidatorsKey(height int64) []byte {
|
|
return calcValidatorsKey(height)
|
|
}
|
|
|
|
// SaveConsensusParamsInfo is an alias for the private saveConsensusParamsInfo
|
|
// method in store.go, exported exclusively and explicitly for testing.
|
|
func SaveConsensusParamsInfo(db dbm.DB, nextHeight, changeHeight int64, params types.ConsensusParams) {
|
|
saveConsensusParamsInfo(db, nextHeight, changeHeight, params)
|
|
}
|
|
|
|
// SaveValidatorsInfo is an alias for the private saveValidatorsInfo method in
|
|
// store.go, exported exclusively and explicitly for testing.
|
|
func SaveValidatorsInfo(db dbm.DB, height, lastHeightChanged int64, valSet *types.ValidatorSet) {
|
|
saveValidatorsInfo(db, height, lastHeightChanged, valSet)
|
|
}
|