Documentation ¶
Index ¶
- type BlockStore
- type ErrAppBlockHeightTooHigh
- type ErrBlockHashMismatch
- type ErrInvalidBlock
- type ErrLastStateMismatch
- type ErrProxyAppConn
- type ErrStateMismatch
- type ErrUnknownBlock
- type Handshaker
- type Mempool
- type MockMempool
- type State
- func (s *State) ApplyBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, ...) error
- func (s *State) Bytes() []byte
- func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, block *types.Block, mempool Mempool) error
- func (s *State) Copy() *State
- func (s *State) Equals(s2 *State) bool
- func (s *State) ExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, ...) error
- func (s *State) GetValidators() (*types.ValidatorSet, *types.ValidatorSet)
- func (s *State) LoadIntermediate()
- func (s *State) Save()
- func (s *State) SaveIntermediate()
- func (s *State) SetBlockAndValidators(header *types.Header, blockPartsHeader types.PartSetHeader, ...)
- func (s *State) ValidateBlock(block *types.Block) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockStore ¶ added in v0.8.0
type BlockStore interface { Height() int LoadBlock(height int) *types.Block LoadBlockMeta(height int) *types.BlockMeta }
TODO: Should we move blockchain/store.go to its own package?
type ErrAppBlockHeightTooHigh ¶ added in v0.8.0
type ErrAppBlockHeightTooHigh struct {
// contains filtered or unexported fields
}
func (ErrAppBlockHeightTooHigh) Error ¶ added in v0.8.0
func (e ErrAppBlockHeightTooHigh) Error() string
type ErrBlockHashMismatch ¶ added in v0.8.0
type ErrBlockHashMismatch struct {
// contains filtered or unexported fields
}
func (ErrBlockHashMismatch) Error ¶ added in v0.8.0
func (e ErrBlockHashMismatch) Error() string
type ErrInvalidBlock ¶ added in v0.8.0
type ErrInvalidBlock error
type ErrLastStateMismatch ¶ added in v0.8.0
type ErrLastStateMismatch struct {
// contains filtered or unexported fields
}
func (ErrLastStateMismatch) Error ¶ added in v0.8.0
func (e ErrLastStateMismatch) Error() string
type ErrProxyAppConn ¶ added in v0.8.0
type ErrProxyAppConn error
type ErrStateMismatch ¶ added in v0.8.0
type ErrStateMismatch struct {
// contains filtered or unexported fields
}
func (ErrStateMismatch) Error ¶ added in v0.8.0
func (e ErrStateMismatch) Error() string
type ErrUnknownBlock ¶ added in v0.8.0
type ErrUnknownBlock struct {
// contains filtered or unexported fields
}
func (ErrUnknownBlock) Error ¶ added in v0.8.0
func (e ErrUnknownBlock) Error() string
type Handshaker ¶ added in v0.8.0
type Handshaker struct {
// contains filtered or unexported fields
}
func NewHandshaker ¶ added in v0.8.0
func NewHandshaker(config cfg.Config, state *State, store BlockStore) *Handshaker
func (*Handshaker) Handshake ¶ added in v0.8.0
func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error
TODO: retry the handshake/replay if it fails ?
func (*Handshaker) ReplayBlocks ¶ added in v0.8.0
func (h *Handshaker) ReplayBlocks(appHash []byte, appBlockHeight int, appConnConsensus proxy.AppConnConsensus) error
Replay all blocks after blockHeight and ensure the result matches the current state.
type Mempool ¶ added in v0.8.0
Updates to the mempool need to be synchronized with committing a block so apps can reset their transient state on Commit
type MockMempool ¶ added in v0.8.0
type MockMempool struct { }
func (MockMempool) Lock ¶ added in v0.8.0
func (m MockMempool) Lock()
func (MockMempool) Unlock ¶ added in v0.8.0
func (m MockMempool) Unlock()
type State ¶
type State struct { // should not change GenesisDoc *types.GenesisDoc ChainID string // updated at end of ExecBlock LastBlockHeight int // Genesis state has this set to 0. So, Block(H=0) does not exist. LastBlockID types.BlockID LastBlockTime time.Time Validators *types.ValidatorSet LastValidators *types.ValidatorSet // block.LastCommit validated against this // AppHash is updated after Commit AppHash []byte // contains filtered or unexported fields }
NOTE: not goroutine-safe.
func GetState ¶ added in v0.8.0
Load the most recent state from "state" db, or create a new one (and save) from genesis.
func MakeGenesisState ¶
func MakeGenesisState(db dbm.DB, genDoc *types.GenesisDoc) *State
func (*State) ApplyBlock ¶ added in v0.8.0
func (s *State) ApplyBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block, partsHeader types.PartSetHeader, mempool Mempool) error
Execute and commit block against app, save block and state
func (*State) CommitStateUpdateMempool ¶ added in v0.8.0
func (s *State) CommitStateUpdateMempool(proxyAppConn proxy.AppConnConsensus, block *types.Block, mempool Mempool) error
mempool must be locked during commit and update because state is typically reset on Commit and old txs must be replayed against committed state before new txs are run in the mempool, lest they be invalid
func (*State) ExecBlock ¶
func (s *State) ExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block, blockPartsHeader types.PartSetHeader) error
Execute the block to mutate State. Validates block and then executes Data.Txs in the block.
func (*State) GetValidators ¶ added in v0.8.0
func (s *State) GetValidators() (*types.ValidatorSet, *types.ValidatorSet)
func (*State) LoadIntermediate ¶ added in v0.8.0
func (s *State) LoadIntermediate()
Load the intermediate state into the current state and do some sanity checks
func (*State) SaveIntermediate ¶ added in v0.8.0
func (s *State) SaveIntermediate()
func (*State) SetBlockAndValidators ¶ added in v0.8.0
func (s *State) SetBlockAndValidators(header *types.Header, blockPartsHeader types.PartSetHeader, prevValSet, nextValSet *types.ValidatorSet)
Mutate state variables to match block and validators after running EndBlock