state

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyBlock added in v0.9.0

func ApplyBlock(appConnConsensus proxy.AppConnConsensus, block *types.Block) ([]byte, error)

Apply and commit a block, but without all the state validation. Returns the application root hash (result of abci.Commit)

Types

type ErrAppBlockHeightTooHigh added in v0.8.0

type ErrAppBlockHeightTooHigh struct {
	CoreHeight int
	AppHeight  int
}

func (ErrAppBlockHeightTooHigh) Error added in v0.8.0

func (e ErrAppBlockHeightTooHigh) Error() string

type ErrBlockHashMismatch added in v0.8.0

type ErrBlockHashMismatch struct {
	CoreHash []byte
	AppHash  []byte
	Height   int
}

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 {
	Height int
	Core   []byte
	App    []byte
}

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 {
	Got      *State
	Expected *State
}

func (ErrStateMismatch) Error added in v0.8.0

func (e ErrStateMismatch) Error() string

type ErrUnknownBlock added in v0.8.0

type ErrUnknownBlock struct {
	Height int
}

func (ErrUnknownBlock) Error added in v0.8.0

func (e ErrUnknownBlock) Error() string

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

func GetState(config cfg.Config, stateDB dbm.DB) *State

Load the most recent state from "state" db, or create a new one (and save) from genesis.

func LoadState

func LoadState(db dbm.DB) *State

func MakeGenesisState

func MakeGenesisState(db dbm.DB, genDoc *types.GenesisDoc) *State

func MakeGenesisStateFromFile

func MakeGenesisStateFromFile(db dbm.DB, genDocFile string) *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 types.Mempool) error

Execute and commit block against app, save block and state

func (*State) Bytes added in v0.8.0

func (s *State) Bytes() []byte

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) Copy

func (s *State) Copy() *State

func (*State) Equals added in v0.8.0

func (s *State) Equals(s2 *State) bool

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) Save

func (s *State) Save()

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

func (*State) ValidateBlock

func (s *State) ValidateBlock(block *types.Block) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL