Documentation ¶
Index ¶
- Constants
- Variables
- func HashAlg() hash.Hash
- func HeaderHash(block *types.Block) types.Hash
- type ConsensusPlugin
- func (instance *ConsensusPlugin) Add(digest types.Hash, payload interface{}) *Content
- func (instance *ConsensusPlugin) GetContentByHash(digest types.Hash) (*Content, error)
- func (instance *ConsensusPlugin) GetLatestBlockHeight() uint64
- func (instance *ConsensusPlugin) Remove(digest types.Hash)
- func (instance *ConsensusPlugin) SetLatestBlockHeight(height uint64)
- type ConsensusResult
- type ConsensusStatus
- type Content
- func (instance *Content) AddSignature(account account.Account, sign []byte) bool
- func (instance *Content) GetContentPayload() interface{}
- func (instance *Content) GetSignByAccount(account account.Account) ([]byte, bool)
- func (instance *Content) GetSignMap() map[account.Account][]byte
- func (instance *Content) SetState(state contentState) error
- func (instance *Content) Signatures() [][]byte
- func (instance *Content) State() contentState
- type MessageSignal
- type OnlineState
- type OnlineWizard
- func (instance *OnlineWizard) AddOnlineResponse(blockHeight uint64, nodes []account.Account, walterLevel int, ...) ([]account.Account, OnlineState)
- func (instance *OnlineWizard) DeleteOnlineResponse(blockHeight uint64)
- func (instance *OnlineWizard) GetCurrentHeight() uint64
- func (instance *OnlineWizard) GetCurrentState() OnlineState
- func (instance *OnlineWizard) GetCurrentStateByHeight(blockHeight uint64) OnlineState
- func (instance *OnlineWizard) GetMasterByBlockHeight(blockHeight uint64) account.Account
- func (instance *OnlineWizard) GetResponseNodesStateByBlockHeight(blockHeight uint64) OnlineState
- type Proposal
- type Request
- type ResponseNodes
- type Version
- type ViewChange
- func (instance *ViewChange) AddViewRequest(viewNum uint64, toChange uint8) (*ViewRequests, error)
- func (instance *ViewChange) GetCurrentViewNum() uint64
- func (instance *ViewChange) GetRequestByViewNum(viewNum uint64) *ViewRequests
- func (instance *ViewChange) GetWalterLevel() int64
- func (instance *ViewChange) RemoveRequest()
- func (instance *ViewChange) SetCurrentViewNum(newViewNum uint64)
- type ViewRequestState
- type ViewRequests
- type ViewStatus
Constants ¶
View Source
const ( SoloPolicy = "solo" SoloConsensusNum = uint8(1) BftPolicy = "bft" FbftPolicy = "fbft" DbftPolicy = "dbft" )
View Source
const ( MaxBufferLen = 1024 * 256 DefaultViewNum = uint64(0) DefaultWalterLevel = int64(1) DefaultBlockHeight = uint64(0) )
View Source
const ( Initial InConsensus ToConsensus )
View Source
const (
ReceiveResponseSignal
)
Variables ¶
View Source
var (
ErrorsNewRepositoryByBlockHash = errors.New("get block chain by hash failed")
)
Functions ¶
Types ¶
type ConsensusPlugin ¶
type ConsensusPlugin struct {
// contains filtered or unexported fields
}
func NewConsensusPlugin ¶
func NewConsensusPlugin() *ConsensusPlugin
func (*ConsensusPlugin) Add ¶
func (instance *ConsensusPlugin) Add(digest types.Hash, payload interface{}) *Content
func (*ConsensusPlugin) GetContentByHash ¶
func (instance *ConsensusPlugin) GetContentByHash(digest types.Hash) (*Content, error)
func (*ConsensusPlugin) GetLatestBlockHeight ¶ added in v0.3.0
func (instance *ConsensusPlugin) GetLatestBlockHeight() uint64
func (*ConsensusPlugin) Remove ¶
func (instance *ConsensusPlugin) Remove(digest types.Hash)
func (*ConsensusPlugin) SetLatestBlockHeight ¶ added in v0.3.0
func (instance *ConsensusPlugin) SetLatestBlockHeight(height uint64)
type ConsensusResult ¶
type ConsensusStatus ¶
type ConsensusStatus uint8
const ( Proposing ConsensusStatus = iota // Proposing --> 0 prepare to launch a proposal Propose // Propose --> 1 propose for a proposal Approve // Approve --> 2 response of participate which accept the proposal Reject // Reject --> 3 response of participate which reject the proposal Committed // Committed --> 4 proposal has been accepted by participates with consensus policy )
type Content ¶
type Content struct {
// contains filtered or unexported fields
}
func (*Content) AddSignature ¶
func (*Content) GetContentPayload ¶ added in v0.3.0
func (instance *Content) GetContentPayload() interface{}
func (*Content) GetSignByAccount ¶
func (*Content) Signatures ¶
type MessageSignal ¶
type MessageSignal uint8
type OnlineState ¶ added in v0.3.0
type OnlineState string
const GoOnline OnlineState = "GoOnline"
const Online OnlineState = "Online"
type OnlineWizard ¶ added in v0.3.0
type OnlineWizard struct {
// contains filtered or unexported fields
}
func NewOnlineWizard ¶ added in v0.3.0
func NewOnlineWizard() *OnlineWizard
func (*OnlineWizard) AddOnlineResponse ¶ added in v0.3.0
func (*OnlineWizard) DeleteOnlineResponse ¶ added in v0.3.0
func (instance *OnlineWizard) DeleteOnlineResponse(blockHeight uint64)
func (*OnlineWizard) GetCurrentHeight ¶ added in v0.3.0
func (instance *OnlineWizard) GetCurrentHeight() uint64
func (*OnlineWizard) GetCurrentState ¶ added in v0.3.0
func (instance *OnlineWizard) GetCurrentState() OnlineState
func (*OnlineWizard) GetCurrentStateByHeight ¶ added in v0.3.0
func (instance *OnlineWizard) GetCurrentStateByHeight(blockHeight uint64) OnlineState
func (*OnlineWizard) GetMasterByBlockHeight ¶ added in v0.3.0
func (instance *OnlineWizard) GetMasterByBlockHeight(blockHeight uint64) account.Account
func (*OnlineWizard) GetResponseNodesStateByBlockHeight ¶ added in v0.3.0
func (instance *OnlineWizard) GetResponseNodesStateByBlockHeight(blockHeight uint64) OnlineState
type Request ¶
type Request struct { Id uint64 Payload *Proposal Status ConsensusStatus }
BFTRequest that with bft policy
type ResponseNodes ¶ added in v0.3.0
type ResponseNodes struct {
// contains filtered or unexported fields
}
func NewResponseNodes ¶ added in v0.3.0
func NewResponseNodes(walterLevel int, master account.Account) *ResponseNodes
func (*ResponseNodes) AddResponseNodes ¶ added in v0.3.0
func (instance *ResponseNodes) AddResponseNodes(node account.Account) ([]account.Account, OnlineState)
func (*ResponseNodes) GetResponseState ¶ added in v0.3.0
func (instance *ResponseNodes) GetResponseState() OnlineState
type ViewChange ¶
type ViewChange struct {
// contains filtered or unexported fields
}
func NewViewChange ¶
func NewViewChange() *ViewChange
func (*ViewChange) AddViewRequest ¶
func (instance *ViewChange) AddViewRequest(viewNum uint64, toChange uint8) (*ViewRequests, error)
func (*ViewChange) GetCurrentViewNum ¶
func (instance *ViewChange) GetCurrentViewNum() uint64
func (*ViewChange) GetRequestByViewNum ¶
func (instance *ViewChange) GetRequestByViewNum(viewNum uint64) *ViewRequests
func (*ViewChange) GetWalterLevel ¶
func (instance *ViewChange) GetWalterLevel() int64
func (*ViewChange) RemoveRequest ¶
func (instance *ViewChange) RemoveRequest()
func (*ViewChange) SetCurrentViewNum ¶
func (instance *ViewChange) SetCurrentViewNum(newViewNum uint64)
type ViewRequestState ¶
type ViewRequestState string
const ViewEnd ViewRequestState = "ViewEnd"
const Viewing ViewRequestState = "Viewing"
type ViewRequests ¶
type ViewRequests struct {
// contains filtered or unexported fields
}
func NewRequests ¶
func NewRequests(toChange uint8) *ViewRequests
func (*ViewRequests) GetReceivedAccounts ¶
func (instance *ViewRequests) GetReceivedAccounts() []account.Account
func (*ViewRequests) GetViewRequestState ¶
func (instance *ViewRequests) GetViewRequestState() ViewRequestState
func (*ViewRequests) ReceiveViewRequestByAccount ¶
func (instance *ViewRequests) ReceiveViewRequestByAccount(account account.Account) ViewRequestState
type ViewStatus ¶
type ViewStatus string
const ViewChanging ViewStatus = "ViewChanging"
const ViewNormal ViewStatus = "ViewNormal"
Click to show internal directories.
Click to hide internal directories.