mirror of
https://github.com/tendermint/tendermint.git
synced 2026-02-10 05:50:19 +00:00
* lite2: move AutoClient into Client Most of the users will want auto update feature, so it makes sense to move it into the Client itself, rather than having a separate abstraction (it makes the code cleaner, but introduces an extra thing the user will need to learn). Also, add `FirstTrustedHeight` func to Client to get first trusted height. * fix db store tests * separate examples for auto and manual clients * AutoUpdate tries to update to latest state NOT 1 header at a time * fix errors * lite2: make Logger an option remove SetLogger func * fix lite cmd * lite2: make concurrency assumptions explicit * fixes after my own review * no need for nextHeightFn sequence func will download intermediate headers * correct comment
44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
package store
|
|
|
|
import "github.com/tendermint/tendermint/types"
|
|
|
|
// Store is anything that can persistenly store headers.
|
|
type Store interface {
|
|
// SaveSignedHeaderAndNextValidatorSet saves a SignedHeader (h: sh.Height)
|
|
// and a ValidatorSet (h: sh.Height+1).
|
|
//
|
|
// height must be > 0.
|
|
SaveSignedHeaderAndNextValidatorSet(sh *types.SignedHeader, valSet *types.ValidatorSet) error
|
|
|
|
// DeleteSignedHeaderAndNextValidatorSet deletes SignedHeader (h: height) and
|
|
// ValidatorSet (h: height+1).
|
|
//
|
|
// height must be > 0.
|
|
DeleteSignedHeaderAndNextValidatorSet(height int64) error
|
|
|
|
// SignedHeader returns the SignedHeader that corresponds to the given
|
|
// height.
|
|
//
|
|
// height must be > 0.
|
|
//
|
|
// If SignedHeader is not found, an error is returned.
|
|
SignedHeader(height int64) (*types.SignedHeader, error)
|
|
|
|
// ValidatorSet returns the ValidatorSet that corresponds to height.
|
|
//
|
|
// height must be > 0.
|
|
//
|
|
// If ValidatorSet is not found, an error is returned.
|
|
ValidatorSet(height int64) (*types.ValidatorSet, error)
|
|
|
|
// LastSignedHeaderHeight returns the last (newest) SignedHeader height.
|
|
//
|
|
// If the store is empty, -1 and nil error are returned.
|
|
LastSignedHeaderHeight() (int64, error)
|
|
|
|
// FirstSignedHeaderHeight returns the first (oldest) SignedHeader height.
|
|
//
|
|
// If the store is empty, -1 and nil error are returned.
|
|
FirstSignedHeaderHeight() (int64, error)
|
|
}
|