github.com/annchain/OG@v0.0.9/consensus/bft/interface.go (about) 1 package bft 2 3 type ProposalCondition struct { 4 ValidHeight uint64 5 } 6 7 // ProposalGenerator is called when a proposal is needed 8 type ProposalGenerator interface { 9 ProduceProposal() (proposal Proposal, validCondition ProposalCondition) 10 } 11 12 // ProposalValidator is called when a proposal is needed to be verified 13 type ProposalValidator interface { 14 ValidateProposal(proposal Proposal) error 15 } 16 17 type DecisionMaker interface { 18 MakeDecision(proposal Proposal, state *HeightRoundState) (ConsensusDecision, error) 19 } 20 21 type BftPeerCommunicatorOutgoing interface { 22 Broadcast(msg BftMessage, peers []BftPeer) 23 Unicast(msg BftMessage, peer BftPeer) 24 } 25 type BftPeerCommunicatorIncoming interface { 26 GetPipeIn() chan *BftMessageEvent 27 GetPipeOut() chan *BftMessageEvent 28 } 29 30 type BftPartner interface { 31 StartNewEra(height uint64, round int) 32 Start() 33 Stop() 34 WaiterLoop() 35 EventLoop() 36 GetBftPeerCommunicatorIncoming() BftPeerCommunicatorIncoming 37 RegisterConsensusReachedListener(listener ConsensusReachedListener) 38 } 39 40 type ConsensusReachedListener interface { 41 GetConsensusDecisionMadeEventChannel() chan ConsensusDecision 42 }