cs_chain

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: LGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GenesisSetUp bool
)

Functions

func IsSetUpGenesis

func IsSetUpGenesis() bool

Types

type BftChainState

type BftChainState interface {
	Chain
	SaveBftBlock(block model.AbstractBlock, seenCommits []model.AbstractVerification) error
}

type CacheChainState

type CacheChainState struct {
	*chain_state.ChainState
	// contains filtered or unexported fields
}

func NewCacheChainState

func NewCacheChainState(cs *chain_state.ChainState) (*CacheChainState, error)

func (*CacheChainState) CurrentBlock

func (chain *CacheChainState) CurrentBlock() model.AbstractBlock

func (*CacheChainState) Genesis

func (chain *CacheChainState) Genesis() model.AbstractBlock

func (*CacheChainState) GetBlock

func (chain *CacheChainState) GetBlock(hash common.Hash, number uint64) model.AbstractBlock

func (*CacheChainState) GetBlockByHash

func (chain *CacheChainState) GetBlockByHash(hash common.Hash) model.AbstractBlock

func (*CacheChainState) GetBlockNumber

func (chain *CacheChainState) GetBlockNumber(hash common.Hash) *uint64

func (*CacheChainState) GetBody

func (chain *CacheChainState) GetBody(hash common.Hash) model.AbstractBody

func (*CacheChainState) GetBodyRLP

func (chain *CacheChainState) GetBodyRLP(hash common.Hash) rlp.RawValue

func (*CacheChainState) GetHeader

func (chain *CacheChainState) GetHeader(hash common.Hash, number uint64) model.AbstractHeader

func (*CacheChainState) GetSlot

func (chain *CacheChainState) GetSlot(block model.AbstractBlock) *uint64

func (*CacheChainState) GetSlotByNum

func (chain *CacheChainState) GetSlotByNum(num uint64) *uint64

func (*CacheChainState) GetVerifiers

func (chain *CacheChainState) GetVerifiers(slot uint64) []common.Address

func (*CacheChainState) HasBlock

func (chain *CacheChainState) HasBlock(hash common.Hash, number uint64) bool

func (*CacheChainState) HasHeader

func (chain *CacheChainState) HasHeader(hash common.Hash, number uint64) bool

func (*CacheChainState) Rollback

func (chain *CacheChainState) Rollback(target uint64) error

func (*CacheChainState) SaveBftBlock

func (chain *CacheChainState) SaveBftBlock(block model.AbstractBlock, seenCommits []model.AbstractVerification) error

type CacheDB

type CacheDB interface {
	GetSeenCommits(blockHeight uint64, blockHash common.Hash) (result []model.AbstractVerification, err error)
	SaveSeenCommits(blockHeight uint64, blockHash common.Hash, commits []model.AbstractVerification) error
}

type ChainHelper

type ChainHelper interface {
	GetChainConfig() *chain_config.ChainConfig
	GetEconomyModel() economy_model.EconomyModel
	GetChainDB() chaindb.Database
}

type CsChainService

type CsChainService struct {
	*CsChainServiceConfig
	*CacheChainState

	FutureBlocks *lru.Cache

	Quit chan struct{}
	// contains filtered or unexported fields
}

func NewCsChainService

func NewCsChainService(config *CsChainServiceConfig, cs *chain_state.ChainState) *CsChainService

func (*CsChainService) CurrentBalance

func (cs *CsChainService) CurrentBalance(address common.Address) *big.Int

func (*CsChainService) GetSeenCommit

func (cs *CsChainService) GetSeenCommit(height uint64) []model.AbstractVerification

func (*CsChainService) GetTransactionNonce

func (cs *CsChainService) GetTransactionNonce(addr common.Address) (nonce uint64, err error)

func (*CsChainService) InitService

func (cs *CsChainService) InitService() error

func (*CsChainService) SaveBlock

func (cs *CsChainService) SaveBlock(block model.AbstractBlock, seenCommits []model.AbstractVerification) error

func (*CsChainService) Stop

func (cs *CsChainService) Stop()

type CsChainServiceConfig

type CsChainServiceConfig struct {
	CacheDB CacheDB
	TxPool  TxPool
}

type StateHelper

type StateHelper interface {
	GetStateStorage() state_processor.StateStorage
	CurrentState() (*state_processor.AccountStateDB, error)
	StateAtByBlockNumber(num uint64) (*state_processor.AccountStateDB, error)
	StateAtByStateRoot(root common.Hash) (*state_processor.AccountStateDB, error)
	BuildStateProcessor(preAccountStateRoot common.Hash) (*state_processor.AccountStateDB, error)
}

type StateReader

type StateReader interface {
	Genesis() model.AbstractBlock
	CurrentBlock() model.AbstractBlock
	CurrentHeader() model.AbstractHeader
	GetBlock(hash common.Hash, number uint64) model.AbstractBlock
	GetBlockByHash(hash common.Hash) model.AbstractBlock
	GetBlockByNumber(number uint64) model.AbstractBlock
	GetLatestNormalBlock() model.AbstractBlock
	HasBlock(hash common.Hash, number uint64) bool
	GetBody(hash common.Hash) model.AbstractBody
	GetBodyRLP(hash common.Hash) rlp.RawValue
	GetHeader(hash common.Hash, number uint64) model.AbstractHeader
	GetHeaderByHash(hash common.Hash) model.AbstractHeader
	GetHeaderByNumber(number uint64) model.AbstractHeader
	GetHeaderRLP(hash common.Hash) rlp.RawValue
	HasHeader(hash common.Hash, number uint64) bool
	GetBlockNumber(hash common.Hash) *uint64
	GetTransaction(txHash common.Hash) (model.AbstractTransaction, common.Hash, uint64, uint64)

	BlockProcessor(root common.Hash) (*chain.BlockProcessor, error)
	BlockProcessorByNumber(num uint64) (*chain.BlockProcessor, error)
}

type StateWriter

type StateWriter interface {
	SaveBlock(block model.AbstractBlock) error
	Rollback(target uint64) error
}

type TxPool

type TxPool interface {
	Reset(oldHead, newHead *model.Header)
}

type VerifierHelper

type VerifierHelper interface {
	CurrentSeed() (common.Hash, uint64)
	IsChangePoint(block model.AbstractBlock, isProcessPackageBlock bool) bool
	GetLastChangePoint(block model.AbstractBlock) *uint64
	GetSlotByNum(num uint64) *uint64
	GetSlot(block model.AbstractBlock) *uint64
	GetCurrVerifiers() []common.Address
	GetVerifiers(round uint64) []common.Address
	GetNextVerifiers() []common.Address
	NumBeforeLastBySlot(slot uint64) *uint64
	BuildRegisterProcessor(preRoot common.Hash) (*registerdb.RegisterDB, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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