Documentation ¶
Index ¶
- func AliveDelegatePeerCount(peers types.Peers, print bool) int
- type DbftConsensus
- func (dbft DbftConsensus) BlockFromPeer(clog *ctxlog.ContextLog, block *blockchain.Block)
- func (dbft DbftConsensus) CheckPackInterval() bool
- func (dbft DbftConsensus) ForkSync(height int64) bool
- func (dbft DbftConsensus) GetRound() types.Round
- func (dbft DbftConsensus) Pack(packTime int64)
- func (dbft DbftConsensus) ReceiveVoteResult(votes blockchain.Votes) bool
- func (dbft DbftConsensus) RecoverFromDB()
- func (dbft DbftConsensus) SaveBlock(block *blockchain.Block, votes blockchain.Votes)
- func (dbft DbftConsensus) SendVote(header blockchain.Header) bool
- func (dbft DbftConsensus) SyncHeight(height int64) bool
- func (dbft DbftConsensus) TryPack() bool
- func (dbft DbftConsensus) ValidatePackRight(packTimeMs, lastBlockTimeMs int64, lastMiner, miner string) bool
- func (dbft DbftConsensus) ValidateVotes(votes blockchain.Votes) bool
- func (dbft DbftConsensus) VoteFromPeer(vote blockchain.PeerBlockVote)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DbftConsensus ¶
type DbftConsensus struct { Round *types.Round Blockchain *blockchain.BlockChain BlockManager *blockchain.BlockManager VoteResults blockchain.VoteResults Client ektclient.IClient // contains filtered or unexported fields }
func NewDbftConsensus ¶
func NewDbftConsensus(Blockchain *blockchain.BlockChain, client ektclient.IClient) *DbftConsensus
func (DbftConsensus) BlockFromPeer ¶
func (dbft DbftConsensus) BlockFromPeer(clog *ctxlog.ContextLog, block *blockchain.Block)
校验从其他委托人节点过来的区块数据
func (DbftConsensus) CheckPackInterval ¶
func (dbft DbftConsensus) CheckPackInterval() bool
func (DbftConsensus) ForkSync ¶
func (dbft DbftConsensus) ForkSync(height int64) bool
func (DbftConsensus) GetRound ¶
func (dbft DbftConsensus) GetRound() types.Round
func (DbftConsensus) ReceiveVoteResult ¶
func (dbft DbftConsensus) ReceiveVoteResult(votes blockchain.Votes) bool
收到从其他节点发送过来的voteResult,校验之后可以写入到区块链中
func (DbftConsensus) SaveBlock ¶
func (dbft DbftConsensus) SaveBlock(block *blockchain.Block, votes blockchain.Votes)
func (DbftConsensus) SendVote ¶
func (dbft DbftConsensus) SendVote(header blockchain.Header) bool
校验从其他委托人节点来的区块成功之后发送投票
func (DbftConsensus) SyncHeight ¶
func (dbft DbftConsensus) SyncHeight(height int64) bool
根据height同步区块
func (DbftConsensus) TryPack ¶
func (dbft DbftConsensus) TryPack() bool
func (DbftConsensus) ValidatePackRight ¶
func (dbft DbftConsensus) ValidatePackRight(packTimeMs, lastBlockTimeMs int64, lastMiner, miner string) bool
func (DbftConsensus) ValidateVotes ¶
func (dbft DbftConsensus) ValidateVotes(votes blockchain.Votes) bool
校验voteResults
func (DbftConsensus) VoteFromPeer ¶
func (dbft DbftConsensus) VoteFromPeer(vote blockchain.PeerBlockVote)
从其他委托人节点发过来的区块的投票进行记录
Click to show internal directories.
Click to hide internal directories.