Documentation ¶
Index ¶
Constants ¶
const GenesisHeight uint64 = 1
GenesisHeight refers to the initial height the genesis block should be.
Variables ¶
var NullBlockHash common.Hash
NullBlockHash is the blockHash for ⊥ value.
var SkipBlockHash common.Hash
SkipBlockHash is the blockHash for SKIP value.
Functions ¶
This section is empty.
Types ¶
type AgreementResult ¶
type AgreementResult struct { BlockHash common.Hash `json:"block_hash"` Position Position `json:"position"` Votes []Vote `json:"votes"` IsEmptyBlock bool `json:"is_empty_block"` Randomness []byte `json:"randomness"` }
AgreementResult describes an agremeent result.
func (*AgreementResult) String ¶
func (r *AgreementResult) String() string
type Block ¶
type Block struct { ProposerID NodeID `json:"proposer_id"` ParentHash common.Hash `json:"parent_hash"` Hash common.Hash `json:"hash"` Position Position `json:"position"` Timestamp time.Time `json:"timestamp"` Payload []byte `json:"payload"` PayloadHash common.Hash `json:"payload_hash"` Witness Witness `json:"witness"` Randomness []byte `json:"randomness"` Signature crypto.Signature `json:"signature"` CRSSignature crypto.Signature `json:"crs_signature"` }
Block represents a single event broadcasted on the network.
func (*Block) IsFinalized ¶
IsFinalized checks if the block is finalized.
type BlockVerifyStatus ¶
type BlockVerifyStatus int
BlockVerifyStatus is the return code for core.Application.VerifyBlock
const ( // VerifyOK: Block is verified. VerifyOK BlockVerifyStatus = iota // VerifyRetryLater: Block is unable to be verified at this moment. // Try again later. VerifyRetryLater // VerifyInvalidBlock: Block is an invalid one. VerifyInvalidBlock )
Enums for return value of core.Application.VerifyBlock.
type BlocksByPosition ¶
type BlocksByPosition []*Block
BlocksByPosition is the helper type for sorting slice of blocks by position.
func (BlocksByPosition) Len ¶
func (bs BlocksByPosition) Len() int
Len implements Len method in sort.Sort interface.
func (BlocksByPosition) Less ¶
func (bs BlocksByPosition) Less(i int, j int) bool
Less implements Less method in sort.Sort interface.
func (*BlocksByPosition) Pop ¶
func (bs *BlocksByPosition) Pop() (ret interface{})
Pop implements Pop method in heap interface.
func (*BlocksByPosition) Push ¶
func (bs *BlocksByPosition) Push(x interface{})
Push implements Push method in heap interface.
func (BlocksByPosition) Swap ¶
func (bs BlocksByPosition) Swap(i int, j int)
Swap implements Swap method in sort.Sort interface.
type Config ¶
type Config struct { // Lambda related. LambdaBA time.Duration LambdaDKG time.Duration // Set related. NotarySetSize uint32 // Time related. RoundLength uint64 MinBlockInterval time.Duration }
Config stands for Current Configuration Parameters.
type Msg ¶
type Msg struct { PeerID interface{} Payload interface{} }
Msg for the network ReceiveChan.
type NodeID ¶
NodeID is the ID type for nodes.
type NodeSet ¶
type NodeSet struct {
IDs map[NodeID]struct{}
}
NodeSet is the node set structure as defined in DEXON consensus core.
func NewNodeSetFromMap ¶
NewNodeSetFromMap creates a new NodeSet from NodeID map.
type Position ¶
Position describes the position in the block lattice of an entity.
func (Position) Newer ¶
Newer checks if one block is newer than another one on the same chain. If two blocks on different chain compared by this function, it would panic.
type SubSetTarget ¶
type SubSetTarget struct {
// contains filtered or unexported fields
}
SubSetTarget is the sub set target for GetSubSet().
func NewNodeLeaderTarget ¶
func NewNodeLeaderTarget(crs common.Hash, height uint64) *SubSetTarget
NewNodeLeaderTarget is the target for getting leader of fast BA.
func NewNotarySetTarget ¶
func NewNotarySetTarget(crs common.Hash) *SubSetTarget
NewNotarySetTarget is the target for getting Notary Set.
type Vote ¶
type Vote struct { VoteHeader `json:"header"` PartialSignature cryptoDKG.PartialSignature `json:"partial_signature"` Signature crypto.Signature `json:"signature"` }
Vote is the vote structure defined in Crypto Shuffle Algorithm.
type VoteHeader ¶
type VoteHeader struct { ProposerID NodeID `json:"proposer_id"` Type VoteType `json:"type"` BlockHash common.Hash `json:"block_hash"` Period uint64 `json:"period"` Position Position `json:"position"` }
VoteHeader is the header for vote, which can be used as map keys.