You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
861 B

  1. package evidence
  2. import (
  3. dbm "github.com/tendermint/tm-db"
  4. "github.com/tendermint/tendermint/state"
  5. "github.com/tendermint/tendermint/types"
  6. )
  7. //go:generate mockery --case underscore --name BlockStore
  8. type BlockStore interface {
  9. LoadBlockMeta(height int64) *types.BlockMeta
  10. }
  11. type StateStore interface {
  12. LoadValidators(height int64) (*types.ValidatorSet, error)
  13. LoadState() state.State
  14. }
  15. type stateStore struct {
  16. db dbm.DB
  17. }
  18. var _ StateStore = &stateStore{}
  19. // This is a temporary measure until stateDB becomes a store
  20. // TODO: deprecate once state has a store
  21. func NewEvidenceStateStore(db dbm.DB) StateStore {
  22. return &stateStore{db}
  23. }
  24. func (s *stateStore) LoadValidators(height int64) (*types.ValidatorSet, error) {
  25. return state.LoadValidators(s.db, height)
  26. }
  27. func (s *stateStore) LoadState() state.State {
  28. return state.LoadState(s.db)
  29. }