Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultBlockIntervalSec = int64(1)
DefaultBlockIntervalSec is the default block generation interval in seconds.
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 { IsTransactionValid(tx *types.Tx) bool VerifyTimestamp(block *types.Block) bool VerifySign(block *types.Block) error 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 ChainDB ¶ added in v0.9.4
type ChainDB interface { GetBestBlock() (*types.Block, error) GetBlockByNo(blockNo types.BlockNo) (*types.Block, error) GetGenesisInfo() *types.Genesis Get(key []byte) []byte NewTx() db.Transaction }
ChainDB 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{} }
Consensus is an interface for a consensus implementation.
type Constructor ¶ added in v0.9.4
Constructor represents a function returning the Consensus interfactor for each 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.