consensus

package
v0.0.0-...-7ede18c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AliveDelegatePeerCount

func AliveDelegatePeerCount(peers types.Peers, print bool) int

获取存活的委托人节点数量

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) Pack

func (dbft DbftConsensus) Pack(packTime int64)

进行下一个区块的打包

func (DbftConsensus) ReceiveVoteResult

func (dbft DbftConsensus) ReceiveVoteResult(votes blockchain.Votes) bool

收到从其他节点发送过来的voteResult,校验之后可以写入到区块链中

func (DbftConsensus) RecoverFromDB

func (dbft DbftConsensus) RecoverFromDB()

从db中recover数据

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)

从其他委托人节点发过来的区块的投票进行记录

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL