Documentation ¶
Index ¶
- Constants
- func GetGovernanceView() (*gov.GovernanceView, error)
- func GetPeersConfig() ([]*config.VBFTPeerStakeInfo, error)
- func GetVbftConfigInfo() (*config.VBFTConfig, error)
- func HashMsg(msg ConsensusMsg) (common.Uint256, error)
- func SerializeVbftMsg(msg ConsensusMsg) ([]byte, error)
- func SignMsg(account *account.Account, msg ConsensusMsg) ([]byte, error)
- type BftAction
- type BftActionType
- type Block
- type BlockFetchRespMsg
- type BlockFromPeers
- type BlockInfoFetchMsg
- type BlockInfoFetchRespMsg
- type BlockInfo_
- type BlockList
- type BlockMsgFromPeer
- type BlockParticipantConfig
- type BlockPool
- type BlockSyncReq
- type CandidateEndorseSigInfo
- type CandidateInfo
- type ChainStore
- type ConsensusMsg
- type ConsensusMsgPayload
- type ConsensusRound
- type ConsensusRoundMsgs
- type EventTimer
- func (self *EventTimer) Cancel2ndProposalTimer(blockNum uint32) error
- func (self *EventTimer) CancelBackoffTimer(blockNum uint32) error
- func (self *EventTimer) CancelCommitMsgTimer(blockNum uint32) error
- func (self *EventTimer) CancelEndorseEmptyBlockTimer(blockNum uint32) error
- func (self *EventTimer) CancelEndorseMsgTimer(blockNum uint32) error
- func (self *EventTimer) CancelProposalBackoffTimer(blockNum uint32) error
- func (self *EventTimer) CancelProposalTimer(blockNum uint32) error
- func (self *EventTimer) CancelTimer(idx uint32) error
- func (self *EventTimer) CancelTxBlockTimeout(blockNum uint32) error
- func (self *EventTimer) Start2ndProposalTimer(blockNum uint32) error
- func (self *EventTimer) StartBackoffTimer(blockNum uint32) error
- func (self *EventTimer) StartCommitTimer(blockNum uint32) error
- func (self *EventTimer) StartEndorseEmptyBlockTimer(blockNum uint32) error
- func (self *EventTimer) StartEndorsingTimer(blockNum uint32) error
- func (self *EventTimer) StartProposalBackoffTimer(blockNum uint32) error
- func (self *EventTimer) StartProposalTimer(blockNum uint32) error
- func (self *EventTimer) StartTimer(Idx uint32, timeout time.Duration) error
- func (self *EventTimer) StartTxBlockTimeout(blockNum uint32) error
- type FaultyReport
- type MsgPool
- func (pool *MsgPool) AddMsg(msg ConsensusMsg, msgHash common.Uint256) error
- func (pool *MsgPool) GetCommitMsgs(blocknum uint32) []ConsensusMsg
- func (pool *MsgPool) GetEndorsementsMsgs(blocknum uint32) []ConsensusMsg
- func (pool *MsgPool) GetProposalMsgs(blocknum uint32) []ConsensusMsg
- func (pool *MsgPool) HasMsg(msg ConsensusMsg, msgHash common.Uint256) bool
- func (pool *MsgPool) Persist() error
- type MsgType
- type Peer
- type PeerPool
- type PeerState
- type PeerSyncer
- type SendMsgEvent
- type Server
- func (self *Server) GetCommittedBlockNo() uint32
- func (self *Server) GetCurrentBlockNo() uint32
- func (self *Server) GetPID() *actor.PID
- func (self *Server) Halt() error
- func (self *Server) LoadChainConfig(chainStore *ChainStore) error
- func (self *Server) NewConsensusPayload(payload *p2pmsg.ConsensusPayload)
- func (self *Server) Receive(context actor.Context)
- func (self *Server) Start() error
- type ServerState
- type StateEvent
- type StateEventType
- type StateMgr
- type SyncCheckReq
- type SyncMsg
- type Syncer
- type TimerEvent
- type TimerEventType
- type TimerItem
- type TimerQueue
Constants ¶
View Source
const ( CAP_MESSAGE_CHANNEL = 64 CAP_ACTION_CHANNEL = 8 CAP_MSG_SEND_CHANNEL = 16 )
View Source
const ( // TODO: move to config file MAX_PEER_CONNECTIONS = 100 MAX_SYNCING_CHECK_BLK_NUM = 10 )
Variables ¶
This section is empty.
Functions ¶
func GetGovernanceView ¶
func GetGovernanceView() (*gov.GovernanceView, error)
func GetPeersConfig ¶
func GetPeersConfig() ([]*config.VBFTPeerStakeInfo, error)
func GetVbftConfigInfo ¶
func GetVbftConfigInfo() (*config.VBFTConfig, error)
func SerializeVbftMsg ¶
func SerializeVbftMsg(msg ConsensusMsg) ([]byte, error)
Types ¶
type BftAction ¶
type BftAction struct { Type BftActionType BlockNum uint32 Proposal *blockProposalMsg // contains filtered or unexported fields }
type BftActionType ¶
type BftActionType uint8
const ( MakeProposal BftActionType = iota EndorseBlock CommitBlock SealBlock FastForward // for syncer catch up ReBroadcast )
type Block ¶
func (*Block) Deserialize ¶
type BlockFetchRespMsg ¶
type BlockFetchRespMsg struct { BlockNumber uint32 `json:"block_number"` BlockHash common.Uint256 `json:"block_hash"` BlockData *Block `json:"block_data"` }
func (*BlockFetchRespMsg) Deserialize ¶
func (msg *BlockFetchRespMsg) Deserialize(data []byte) error
func (*BlockFetchRespMsg) GetBlockNum ¶
func (msg *BlockFetchRespMsg) GetBlockNum() uint32
func (*BlockFetchRespMsg) Serialize ¶
func (msg *BlockFetchRespMsg) Serialize() ([]byte, error)
func (*BlockFetchRespMsg) Type ¶
func (msg *BlockFetchRespMsg) Type() MsgType
type BlockFromPeers ¶
type BlockInfoFetchMsg ¶
type BlockInfoFetchMsg struct {
StartBlockNum uint32 `json:"start_block_num"`
}
func (*BlockInfoFetchMsg) GetBlockNum ¶
func (msg *BlockInfoFetchMsg) GetBlockNum() uint32
func (*BlockInfoFetchMsg) Serialize ¶
func (msg *BlockInfoFetchMsg) Serialize() ([]byte, error)
func (*BlockInfoFetchMsg) Type ¶
func (msg *BlockInfoFetchMsg) Type() MsgType
type BlockInfoFetchRespMsg ¶
type BlockInfoFetchRespMsg struct {
Blocks []*BlockInfo_ `json:"blocks"`
}
to fetch committed block from neighbours
func (*BlockInfoFetchRespMsg) GetBlockNum ¶
func (msg *BlockInfoFetchRespMsg) GetBlockNum() uint32
func (*BlockInfoFetchRespMsg) Serialize ¶
func (msg *BlockInfoFetchRespMsg) Serialize() ([]byte, error)
func (*BlockInfoFetchRespMsg) Type ¶
func (msg *BlockInfoFetchRespMsg) Type() MsgType
type BlockInfo_ ¶
type BlockMsgFromPeer ¶
type BlockMsgFromPeer struct {
// contains filtered or unexported fields
}
type BlockParticipantConfig ¶
type BlockPool ¶
type BlockPool struct { HistoryLen uint32 // contains filtered or unexported fields }
type BlockSyncReq ¶
type BlockSyncReq struct {
// contains filtered or unexported fields
}
type CandidateEndorseSigInfo ¶
type CandidateInfo ¶
type CandidateInfo struct { // server endorsed proposals EndorsedProposal *blockProposalMsg EndorsedEmptyProposal *blockProposalMsg // server committed proposals (one of them must be nil) CommittedProposal *blockProposalMsg CommittedEmptyProposal *blockProposalMsg // server sealed block for this round SealedBlock *Block // candidate msgs for this round Proposals []*blockProposalMsg CommitMsgs []*blockCommitMsg // indexed by endorserIndex EndorseSigs map[uint32][]*CandidateEndorseSigInfo // contains filtered or unexported fields }
type ChainStore ¶
type ChainStore struct {
// contains filtered or unexported fields
}
func OpenBlockStore ¶
func OpenBlockStore(db *ledger.Ledger) (*ChainStore, error)
func (*ChainStore) AddBlock ¶
func (self *ChainStore) AddBlock(block *Block) error
func (*ChainStore) GetChainedBlockNum ¶
func (self *ChainStore) GetChainedBlockNum() uint32
func (*ChainStore) ReloadFromLedger ¶
func (self *ChainStore) ReloadFromLedger()
type ConsensusMsg ¶
type ConsensusMsg interface { Type() MsgType Verify(pub keypair.PublicKey) error GetBlockNum() uint32 Serialize() ([]byte, error) }
func DeserializeVbftMsg ¶
func DeserializeVbftMsg(msgPayload []byte) (ConsensusMsg, error)
type ConsensusMsgPayload ¶
type ConsensusRound ¶
type ConsensusRound struct {
// contains filtered or unexported fields
}
type ConsensusRoundMsgs ¶
type ConsensusRoundMsgs map[MsgType][]ConsensusMsg // indexed by MsgType (proposal, endorsement, ...)
type EventTimer ¶
type EventTimer struct { C chan *TimerEvent // contains filtered or unexported fields }
func NewEventTimer ¶
func NewEventTimer(server *Server) *EventTimer
func (*EventTimer) Cancel2ndProposalTimer ¶
func (self *EventTimer) Cancel2ndProposalTimer(blockNum uint32) error
func (*EventTimer) CancelBackoffTimer ¶
func (self *EventTimer) CancelBackoffTimer(blockNum uint32) error
func (*EventTimer) CancelCommitMsgTimer ¶
func (self *EventTimer) CancelCommitMsgTimer(blockNum uint32) error
func (*EventTimer) CancelEndorseEmptyBlockTimer ¶
func (self *EventTimer) CancelEndorseEmptyBlockTimer(blockNum uint32) error
func (*EventTimer) CancelEndorseMsgTimer ¶
func (self *EventTimer) CancelEndorseMsgTimer(blockNum uint32) error
func (*EventTimer) CancelProposalBackoffTimer ¶
func (self *EventTimer) CancelProposalBackoffTimer(blockNum uint32) error
func (*EventTimer) CancelProposalTimer ¶
func (self *EventTimer) CancelProposalTimer(blockNum uint32) error
func (*EventTimer) CancelTimer ¶
func (self *EventTimer) CancelTimer(idx uint32) error
func (*EventTimer) CancelTxBlockTimeout ¶
func (self *EventTimer) CancelTxBlockTimeout(blockNum uint32) error
func (*EventTimer) Start2ndProposalTimer ¶
func (self *EventTimer) Start2ndProposalTimer(blockNum uint32) error
func (*EventTimer) StartBackoffTimer ¶
func (self *EventTimer) StartBackoffTimer(blockNum uint32) error
func (*EventTimer) StartCommitTimer ¶
func (self *EventTimer) StartCommitTimer(blockNum uint32) error
func (*EventTimer) StartEndorseEmptyBlockTimer ¶
func (self *EventTimer) StartEndorseEmptyBlockTimer(blockNum uint32) error
func (*EventTimer) StartEndorsingTimer ¶
func (self *EventTimer) StartEndorsingTimer(blockNum uint32) error
func (*EventTimer) StartProposalBackoffTimer ¶
func (self *EventTimer) StartProposalBackoffTimer(blockNum uint32) error
func (*EventTimer) StartProposalTimer ¶
func (self *EventTimer) StartProposalTimer(blockNum uint32) error
func (*EventTimer) StartTimer ¶
func (self *EventTimer) StartTimer(Idx uint32, timeout time.Duration) error
func (*EventTimer) StartTxBlockTimeout ¶
func (self *EventTimer) StartTxBlockTimeout(blockNum uint32) error
type FaultyReport ¶
type MsgPool ¶
type MsgPool struct {
// contains filtered or unexported fields
}
func (*MsgPool) AddMsg ¶
func (pool *MsgPool) AddMsg(msg ConsensusMsg, msgHash common.Uint256) error
func (*MsgPool) GetCommitMsgs ¶
func (pool *MsgPool) GetCommitMsgs(blocknum uint32) []ConsensusMsg
func (*MsgPool) GetEndorsementsMsgs ¶
func (pool *MsgPool) GetEndorsementsMsgs(blocknum uint32) []ConsensusMsg
func (*MsgPool) GetProposalMsgs ¶
func (pool *MsgPool) GetProposalMsgs(blocknum uint32) []ConsensusMsg
type PeerPool ¶
type PeerPool struct { IDMap map[string]uint32 P2pMap map[uint32]uint64 //value: p2p random id // contains filtered or unexported fields }
func NewPeerPool ¶
func (*PeerPool) GetPeerPubKey ¶
func (*PeerPool) RemovePeerIndex ¶
type PeerSyncer ¶
type PeerSyncer struct {
// contains filtered or unexported fields
}
type SendMsgEvent ¶
type SendMsgEvent struct { ToPeer uint32 // peer index Msg ConsensusMsg }
type Server ¶
type Server struct { Index uint32 LastConfigBlockNum uint32 // contains filtered or unexported fields }
func NewVbftServer ¶
func (*Server) GetCommittedBlockNo ¶
func (*Server) GetCurrentBlockNo ¶
func (*Server) LoadChainConfig ¶
func (self *Server) LoadChainConfig(chainStore *ChainStore) error
func (*Server) NewConsensusPayload ¶
func (self *Server) NewConsensusPayload(payload *p2pmsg.ConsensusPayload)
type ServerState ¶
type ServerState int
const ( Init ServerState = iota LocalConfigured Configured // config loaded from chain Syncing // syncing block from neighbours WaitNetworkReady // sync reached, and keep synced, try connecting with more peers SyncReady // start processing consensus msg, but not broadcasting proposal/endorse/commit Synced // start bft SyncingCheck // potentially lost syncing )
type StateEvent ¶
type StateEvent struct { Type StateEventType // contains filtered or unexported fields }
type StateEventType ¶
type StateEventType int
const ( ConfigLoaded StateEventType = iota UpdatePeerConfig // notify statemgmt on peer heartbeat UpdatePeerState // notify statemgmt on peer heartbeat SyncReadyTimeout SyncDone LiveTick )
type StateMgr ¶
type StateMgr struct { StateEventC chan *StateEvent // contains filtered or unexported fields }
type SyncCheckReq ¶
type SyncCheckReq struct {
// contains filtered or unexported fields
}
type TimerEvent ¶
type TimerEvent struct {
// contains filtered or unexported fields
}
type TimerEventType ¶
type TimerEventType int
const ( EventProposeBlockTimeout TimerEventType = iota EventProposalBackoff EventRandomBackoff EventPropose2ndBlockTimeout EventEndorseBlockTimeout EventEndorseEmptyBlockTimeout EventCommitBlockTimeout EventPeerHeartbeat EventTxPool EventTxBlockTimeout EventMax )
type TimerQueue ¶
type TimerQueue []*TimerItem
func (TimerQueue) Len ¶
func (tq TimerQueue) Len() int
func (TimerQueue) Less ¶
func (tq TimerQueue) Less(i, j int) bool
func (*TimerQueue) Pop ¶
func (tq *TimerQueue) Pop() interface{}
func (*TimerQueue) Push ¶
func (tq *TimerQueue) Push(x interface{})
func (TimerQueue) Swap ¶
func (tq TimerQueue) Swap(i, j int)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.