Documentation
¶
Index ¶
- Constants
- func Hash(content []byte) string
- type ActionIn
- type ConsensusFinish
- type ConsensusHelp
- type ConsensusVerify
- type MsgLogs
- func (m *MsgLogs) Clear()
- func (m *MsgLogs) GetCommitCount() int
- func (m *MsgLogs) GetCommitMessages() map[string]*VoteMsg
- func (m *MsgLogs) GetCommitMsgs(key string) (data *VoteMsg)
- func (m *MsgLogs) GetCommitMsgsSigns() []*types.PbftSign
- func (m *MsgLogs) GetCommitOne() *VoteMsg
- func (m *MsgLogs) GetCommitPassCount() int
- func (m *MsgLogs) GetPrepareCount() int
- func (m *MsgLogs) GetPrepareMessages() map[string]*VoteMsg
- func (m *MsgLogs) GetPrepareMsg(key string) (data *VoteMsg)
- func (m *MsgLogs) GetPrepareOne() *VoteMsg
- func (m *MsgLogs) SetCommitMsgs(key string, data *VoteMsg)
- func (m *MsgLogs) SetPrepareMsg(key string, data *VoteMsg)
- type MsgType
- type PBFT
- type PrePrepareMsg
- type ReplyMsg
- type RequestMsg
- type SignedVoteMsg
- type Stage
- type State
- func (state *State) Commit(commitMsg *VoteMsg, f float64) (*ReplyMsg, *RequestMsg, error)
- func (state *State) PrePrepare(prePrepareMsg *PrePrepareMsg) (*VoteMsg, error)
- func (state *State) Prepare(prepareMsg *VoteMsg, f float64) (*VoteMsg, error)
- func (state *State) StartConsensus(request *RequestMsg) (*PrePrepareMsg, error)
- func (state *State) VerifyMsg(viewID int64, sequenceID int64, digestGot string) bool
- type StorgePrepareMsg
- type VoteMsg
Constants ¶
View Source
const ( Agree int = iota Against ActionFecth ActionBroadcast ActionFinish )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConsensusFinish ¶
type ConsensusFinish interface {
ConsensusFinish()
}
type ConsensusHelp ¶
type ConsensusVerify ¶
type ConsensusVerify interface {
SignMsg(h int64, res uint) *SignedVoteMsg
CheckMsg(msg *RequestMsg) (*types.PbftSign, error)
ReplyResult(msg *RequestMsg, signs []*types.PbftSign, res uint) bool
InsertBlock(msg *PrePrepareMsg) bool
RepeatFetch(id *big.Int, height int64)
}
type MsgLogs ¶
type MsgLogs struct {
ReqMsg *RequestMsg
// contains filtered or unexported fields
}
func (*MsgLogs) GetCommitCount ¶
func (*MsgLogs) GetCommitMessages ¶
func (*MsgLogs) GetCommitMsgs ¶
func (*MsgLogs) GetCommitMsgsSigns ¶
func (*MsgLogs) GetCommitOne ¶
func (*MsgLogs) GetCommitPassCount ¶
func (*MsgLogs) GetPrepareCount ¶
func (*MsgLogs) GetPrepareMessages ¶
func (*MsgLogs) GetPrepareMsg ¶
func (*MsgLogs) GetPrepareOne ¶
func (*MsgLogs) SetCommitMsgs ¶
func (*MsgLogs) SetPrepareMsg ¶
type PBFT ¶
type PBFT interface {
StartConsensus(request *RequestMsg) (*PrePrepareMsg, error)
PrePrepare(prePrepareMsg *PrePrepareMsg) (*VoteMsg, error)
Prepare(prepareMsg *VoteMsg) (*VoteMsg, error)
Commit(commitMsg *VoteMsg) (*ReplyMsg, *RequestMsg, error)
}
type PrePrepareMsg ¶
type PrePrepareMsg struct {
ViewID int64 `json:"viewID"`
SequenceID int64 `json:"sequenceID"`
Digest string `json:"digest"`
RequestMsg *RequestMsg `json:"requestMsg"`
Height int64 `json:"Height"`
}
type RequestMsg ¶
type SignedVoteMsg ¶
type Stage ¶
type Stage int
const ( Idle Stage = iota // Node is created successfully, but the consensus process is not started yet. PrePrepared // The ReqMsgs is processed successfully. The node is ready to head to the Prepare stage. Prepared // Same with `prepared` stage explained in the original paper. Committed // Same with `committed-local` stage explained in the original paper. )
type State ¶
type State struct {
ViewID int64
MsgLogs *MsgLogs
LastSequenceID int64
CurrentStage Stage
FastStage Stage
BlockResults *SignedVoteMsg
Clear bool
MySign *types.PbftSign
}
func CreateState ¶
lastSequenceID will be -1 if there is no last sequence ID.
func (*State) PrePrepare ¶
func (state *State) PrePrepare(prePrepareMsg *PrePrepareMsg) (*VoteMsg, error)
func (*State) StartConsensus ¶
func (state *State) StartConsensus(request *RequestMsg) (*PrePrepareMsg, error)
type StorgePrepareMsg ¶
Click to show internal directories.
Click to hide internal directories.