Documentation ¶
Index ¶
- type ChainState
- func (cs *ChainState) BlockProcessor(root common.Hash) (*chain.BlockProcessor, error)
- func (cs *ChainState) BlockProcessorByNumber(num uint64) (*chain.BlockProcessor, error)
- func (cs *ChainState) BuildRegisterProcessor(preBlockRegisterRoot common.Hash) (*registerdb.RegisterDB, error)
- func (cs *ChainState) BuildStateProcessor(preAccountStateRoot common.Hash) (*state_processor.AccountStateDB, error)
- func (cs *ChainState) CalVerifiers(block model.AbstractBlock) []common.Address
- func (cs *ChainState) CurrentBlock() model.AbstractBlock
- func (cs *ChainState) CurrentHeader() model.AbstractHeader
- func (cs *ChainState) CurrentSeed() (common.Hash, uint64)
- func (cs *ChainState) CurrentState() (*state_processor.AccountStateDB, error)
- func (cs *ChainState) Genesis() model.AbstractBlock
- func (cs *ChainState) GetBlock(hash common.Hash, number uint64) model.AbstractBlock
- func (cs *ChainState) GetBlockByHash(hash common.Hash) model.AbstractBlock
- func (cs *ChainState) GetBlockByNumber(number uint64) model.AbstractBlock
- func (cs *ChainState) GetBlockNumber(hash common.Hash) *uint64
- func (cs *ChainState) GetBody(hash common.Hash) model.AbstractBody
- func (cs *ChainState) GetBodyRLP(hash common.Hash) rlp.RawValue
- func (cs *ChainState) GetChainConfig() *chain_config.ChainConfig
- func (cs *ChainState) GetChainDB() chaindb.Database
- func (cs *ChainState) GetCurrVerifiers() []common.Address
- func (cs *ChainState) GetDB() ethdb.Database
- func (cs *ChainState) GetEconomyModel() economy_model.EconomyModel
- func (cs *ChainState) GetHeader(hash common.Hash, number uint64) model.AbstractHeader
- func (cs *ChainState) GetHeaderByHash(hash common.Hash) model.AbstractHeader
- func (cs *ChainState) GetHeaderByNumber(number uint64) model.AbstractHeader
- func (cs *ChainState) GetHeaderRLP(hash common.Hash) rlp.RawValue
- func (cs *ChainState) GetLastChangePoint(block model.AbstractBlock) *uint64
- func (cs *ChainState) GetLatestNormalBlock() model.AbstractBlock
- func (cs *ChainState) GetNextVerifiers() []common.Address
- func (cs *ChainState) GetNumBySlot(slot uint64) *uint64
- func (cs *ChainState) GetSlot(block model.AbstractBlock) *uint64
- func (cs *ChainState) GetSlotByNum(num uint64) *uint64
- func (cs *ChainState) GetStateStorage() state_processor.StateStorage
- func (cs *ChainState) GetTransaction(txHash common.Hash) (model.AbstractTransaction, common.Hash, uint64, uint64)
- func (cs *ChainState) GetVerifiers(slot uint64) []common.Address
- func (cs *ChainState) HasBlock(hash common.Hash, number uint64) bool
- func (cs *ChainState) HasHeader(hash common.Hash, number uint64) bool
- func (cs *ChainState) IsChangePoint(block model.AbstractBlock, isProcessPackageBlock bool) bool
- func (cs *ChainState) NumBeforeLastBySlot(slot uint64) *uint64
- func (cs *ChainState) Rollback(target uint64) error
- func (cs *ChainState) SaveBftBlock(block model.AbstractBlock, seenCommits []model.AbstractVerification) error
- func (cs *ChainState) SaveBlock(block model.AbstractBlock) error
- func (cs *ChainState) SaveBlockWithoutVotes(block model.AbstractBlock) error
- func (cs *ChainState) StateAtByBlockNumber(num uint64) (*state_processor.AccountStateDB, error)
- func (cs *ChainState) StateAtByStateRoot(root common.Hash) (*state_processor.AccountStateDB, error)
- type ChainStateConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainState ¶
type ChainState struct { *ChainStateConfig ChainDB chaindb.Database StateStorage state_processor.StateStorage EconomyModel economy_model.EconomyModel // contains filtered or unexported fields }
the struct of ChainState
func (*ChainState) BlockProcessor ¶
func (cs *ChainState) BlockProcessor(root common.Hash) (*chain.BlockProcessor, error)
create a new BlockProcessor according to the root hash
func (*ChainState) BlockProcessorByNumber ¶
func (cs *ChainState) BlockProcessorByNumber(num uint64) (*chain.BlockProcessor, error)
create a new BlockProcessor according to the number
func (*ChainState) BuildRegisterProcessor ¶
func (cs *ChainState) BuildRegisterProcessor(preBlockRegisterRoot common.Hash) (*registerdb.RegisterDB, error)
func (*ChainState) BuildStateProcessor ¶
func (cs *ChainState) BuildStateProcessor(preAccountStateRoot common.Hash) (*state_processor.AccountStateDB, error)
func (*ChainState) CalVerifiers ¶
func (cs *ChainState) CalVerifiers(block model.AbstractBlock) []common.Address
Calculate the verifiers after two rounds based on the last block of each round
func (*ChainState) CurrentBlock ¶
func (cs *ChainState) CurrentBlock() model.AbstractBlock
func (*ChainState) CurrentHeader ¶
func (cs *ChainState) CurrentHeader() model.AbstractHeader
func (*ChainState) CurrentSeed ¶
func (cs *ChainState) CurrentSeed() (common.Hash, uint64)
func (*ChainState) CurrentState ¶
func (cs *ChainState) CurrentState() (*state_processor.AccountStateDB, error)
func (*ChainState) Genesis ¶
func (cs *ChainState) Genesis() model.AbstractBlock
func (*ChainState) GetBlock ¶
func (cs *ChainState) GetBlock(hash common.Hash, number uint64) model.AbstractBlock
func (*ChainState) GetBlockByHash ¶
func (cs *ChainState) GetBlockByHash(hash common.Hash) model.AbstractBlock
func (*ChainState) GetBlockByNumber ¶
func (cs *ChainState) GetBlockByNumber(number uint64) model.AbstractBlock
func (*ChainState) GetBlockNumber ¶
func (cs *ChainState) GetBlockNumber(hash common.Hash) *uint64
func (*ChainState) GetBody ¶
func (cs *ChainState) GetBody(hash common.Hash) model.AbstractBody
func (*ChainState) GetBodyRLP ¶
func (cs *ChainState) GetBodyRLP(hash common.Hash) rlp.RawValue
func (*ChainState) GetChainConfig ¶
func (cs *ChainState) GetChainConfig() *chain_config.ChainConfig
get the configuration of the chain
func (*ChainState) GetChainDB ¶
func (cs *ChainState) GetChainDB() chaindb.Database
get the database of the chain
func (*ChainState) GetCurrVerifiers ¶
func (cs *ChainState) GetCurrVerifiers() []common.Address
func (*ChainState) GetDB ¶
func (cs *ChainState) GetDB() ethdb.Database
get the database of the ChainState
func (*ChainState) GetEconomyModel ¶
func (cs *ChainState) GetEconomyModel() economy_model.EconomyModel
get economy model
func (*ChainState) GetHeader ¶
func (cs *ChainState) GetHeader(hash common.Hash, number uint64) model.AbstractHeader
func (*ChainState) GetHeaderByHash ¶
func (cs *ChainState) GetHeaderByHash(hash common.Hash) model.AbstractHeader
func (*ChainState) GetHeaderByNumber ¶
func (cs *ChainState) GetHeaderByNumber(number uint64) model.AbstractHeader
func (*ChainState) GetHeaderRLP ¶
func (cs *ChainState) GetHeaderRLP(hash common.Hash) rlp.RawValue
func (*ChainState) GetLastChangePoint ¶
func (cs *ChainState) GetLastChangePoint(block model.AbstractBlock) *uint64
func (*ChainState) GetLatestNormalBlock ¶
func (cs *ChainState) GetLatestNormalBlock() model.AbstractBlock
func (*ChainState) GetNextVerifiers ¶
func (cs *ChainState) GetNextVerifiers() []common.Address
func (*ChainState) GetNumBySlot ¶
func (cs *ChainState) GetNumBySlot(slot uint64) *uint64
The returned value is the last block of the slot. If the slot is incomplete, it returns null.
func (*ChainState) GetSlot ¶
func (cs *ChainState) GetSlot(block model.AbstractBlock) *uint64
func (*ChainState) GetSlotByNum ¶
func (cs *ChainState) GetSlotByNum(num uint64) *uint64
This layer of queries does not use the cache, so try to minimize the query call
func (*ChainState) GetStateStorage ¶
func (cs *ChainState) GetStateStorage() state_processor.StateStorage
func (*ChainState) GetTransaction ¶
func (cs *ChainState) GetTransaction(txHash common.Hash) (model.AbstractTransaction, common.Hash, uint64, uint64)
func (*ChainState) GetVerifiers ¶
func (cs *ChainState) GetVerifiers(slot uint64) []common.Address
func (*ChainState) HasHeader ¶
func (cs *ChainState) HasHeader(hash common.Hash, number uint64) bool
func (*ChainState) IsChangePoint ¶
func (cs *ChainState) IsChangePoint(block model.AbstractBlock, isProcessPackageBlock bool) bool
func (*ChainState) NumBeforeLastBySlot ¶
func (cs *ChainState) NumBeforeLastBySlot(slot uint64) *uint64
Get the last block of the last two rounds. Its seed is needed to calculate verifiers maybe need a cache
func (*ChainState) Rollback ¶
func (cs *ChainState) Rollback(target uint64) error
func (*ChainState) SaveBftBlock ¶
func (cs *ChainState) SaveBftBlock(block model.AbstractBlock, seenCommits []model.AbstractVerification) error
func (*ChainState) SaveBlock ¶
func (cs *ChainState) SaveBlock(block model.AbstractBlock) error
func (*ChainState) SaveBlockWithoutVotes ¶
func (cs *ChainState) SaveBlockWithoutVotes(block model.AbstractBlock) error
func (*ChainState) StateAtByBlockNumber ¶
func (cs *ChainState) StateAtByBlockNumber(num uint64) (*state_processor.AccountStateDB, error)
func (*ChainState) StateAtByStateRoot ¶
func (cs *ChainState) StateAtByStateRoot(root common.Hash) (*state_processor.AccountStateDB, error)
type ChainStateConfig ¶
type ChainStateConfig struct { ChainConfig *chain_config.ChainConfig DataDir string WriterFactory chain_writer.AbstractChainWriterFactory }
configuration of ChainState