Documentation ¶
Index ¶
- func ExecCommitBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block) ([]byte, error)
- type ABCIResponses
- type ErrAppBlockHeightTooHigh
- type ErrBlockHashMismatch
- type ErrInvalidBlock
- type ErrLastStateMismatch
- type ErrProxyAppConn
- type ErrStateMismatch
- type ErrUnknownBlock
- 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 types.Mempool) error
- func (s *State) Copy() *State
- func (s *State) Equals(s2 *State) bool
- func (s *State) GetValidators() (*types.ValidatorSet, *types.ValidatorSet)
- func (s *State) LoadABCIResponses() *ABCIResponses
- func (s *State) Save()
- func (s *State) SaveABCIResponses(abciResponses *ABCIResponses)
- func (s *State) SetBlockAndValidators(header *types.Header, blockPartsHeader types.PartSetHeader, ...)
- func (s *State) ValExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, ...) (*ABCIResponses, error)
- func (s *State) ValidateBlock(block *types.Block) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecCommitBlock ¶
Exec and commit a block on the proxyApp without validating or mutating the state Returns the application root hash (result of abci.Commit)
Types ¶
type ABCIResponses ¶
type ABCIResponses struct { Height int DeliverTx []*abci.ResponseDeliverTx EndBlock abci.ResponseEndBlock // contains filtered or unexported fields }
func NewABCIResponses ¶
func NewABCIResponses(block *types.Block) *ABCIResponses
type ErrAppBlockHeightTooHigh ¶
func (ErrAppBlockHeightTooHigh) Error ¶
func (e ErrAppBlockHeightTooHigh) Error() string
type ErrBlockHashMismatch ¶
func (ErrBlockHashMismatch) Error ¶
func (e ErrBlockHashMismatch) Error() string
type ErrInvalidBlock ¶
type ErrInvalidBlock error
type ErrLastStateMismatch ¶
func (ErrLastStateMismatch) Error ¶
func (e ErrLastStateMismatch) Error() string
type ErrProxyAppConn ¶
type ErrProxyAppConn error
type ErrStateMismatch ¶
func (ErrStateMismatch) Error ¶
func (e ErrStateMismatch) Error() string
type ErrUnknownBlock ¶
type ErrUnknownBlock struct {
Height int
}
func (ErrUnknownBlock) Error ¶
func (e ErrUnknownBlock) Error() string
type State ¶
type State struct { // should not change GenesisDoc *types.GenesisDoc ChainID string // updated at end of SetBlockAndValidators 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 TxIndexer txindex.TxIndexer `json:"-"` // Transaction indexer. // 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
MakeGenesisState creates state from types.GenesisDoc.
Used in tests.
func MakeGenesisStateFromFile ¶
MakeGenesisStateFromFile reads and unmarshals state from the given file.
Used during replay and in tests.
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 types.Mempool) error
Validate, 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 types.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) GetValidators ¶ added in v0.8.0
func (s *State) GetValidators() (*types.ValidatorSet, *types.ValidatorSet)
func (*State) LoadABCIResponses ¶ added in v0.9.1
func (s *State) LoadABCIResponses() *ABCIResponses
func (*State) SaveABCIResponses ¶ added in v0.9.1
func (s *State) SaveABCIResponses(abciResponses *ABCIResponses)
Sets the ABCIResponses in the state and writes them to disk in case we crash after app.Commit and before s.Save()
func (*State) SetBlockAndValidators ¶ added in v0.8.0
func (s *State) SetBlockAndValidators(header *types.Header, blockPartsHeader types.PartSetHeader, abciResponses *ABCIResponses)
Mutate state variables to match block and validators after running EndBlock
func (*State) ValExecBlock ¶ added in v0.9.1
func (s *State) ValExecBlock(eventCache types.Fireable, proxyAppConn proxy.AppConnConsensus, block *types.Block) (*ABCIResponses, error)
ValExecBlock executes the block, but does NOT mutate State. + validates the block + executes block.Txs on the proxyAppConn