Documentation ¶
Index ¶
Constants ¶
View Source
const ( // DefaultBlockIntervalSec is the default block generation interval in seconds. DefaultBlockIntervalSec = int64(1) // block production interval in sec // DefaultDposBpNumber is the default number of block producers. DefaultDposBpNumber = 23 )
Variables ¶
View Source
var ( // BlockIntervalSec is the block genration interval in seconds. BlockIntervalSec = DefaultBlockIntervalSec // BlockInterval is the maximum block generation time limit. BlockInterval = time.Second * time.Duration(DefaultBlockIntervalSec) )
Functions ¶
func InitBlockInterval ¶
func InitBlockInterval(blockIntervalSec int64)
InitBlockInterval initializes block interval parameters.
Types ¶
type BlockFactory ¶
type BlockFactory interface { Start() JobQueue() chan<- interface{} }
BlockFactory is an interface for a block factory implementation.
type ChainConsensus ¶
type ChainConsensus interface { SetStateDB(sdb *state.ChainStateDB) IsTransactionValid(tx *types.Tx) bool IsBlockValid(block *types.Block, bestBlock *types.Block) error Update(block *types.Block) Save(tx db.Transaction) error NeedReorganization(rootNo types.BlockNo) bool }
ChainConsensus includes chainstatus and validation API.
type ChainDbReader ¶
type ChainDbReader interface { GetBestBlock() (*types.Block, error) GetBlockByNo(blockNo types.BlockNo) (*types.Block, error) GetGenesisInfo() *types.Genesis Get(key []byte) []byte }
ChainDbReader is a reader interface for the ChainDB.
type Consensus ¶
type Consensus interface { ChainConsensus Ticker() *time.Ticker QueueJob(now time.Time, jq chan<- interface{}) BlockFactory() BlockFactory QuitChan() chan interface{} SetChainAccessor(chainAccessor types.ChainAccessor) }
Consensus is an interface for a consensus implementation.
type ErrorConsensus ¶
ErrorConsensus is a basic error struct for consensus modules.
func (ErrorConsensus) Error ¶
func (e ErrorConsensus) Error() string
Click to show internal directories.
Click to hide internal directories.