Documentation ¶
Index ¶
- Variables
- func DBlockSealHash(block dpos.DBlock) (hash ecom.Uint256, err error)
- func SealHash(header *types.Header) (hash common.Hash)
- type API
- type Pbft
- func (p *Pbft) APIs(chain consensus.ChainReader) []rpc.API
- func (p *Pbft) AccessFutureBlock(parent *types.Block)
- func (p *Pbft) AddDirectLinkPeer(pid peer.PID, addr string)
- func (p *Pbft) AnnounceDAddr() bool
- func (p *Pbft) Author(header *types.Header) (common.Address, error)
- func (p *Pbft) BroadBlockMsg(block *types.Block) error
- func (p *Pbft) BroadMessage(msg elap2p.Message)
- func (p *Pbft) BroadMessageExcept(msg elap2p.Message, exceptPeer peer.PID)
- func (p *Pbft) BroadMessageToPeers(msg elap2p.Message, peers [][]byte)
- func (p *Pbft) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int
- func (p *Pbft) CleanFinalConfirmedBlock(height uint64)
- func (p *Pbft) Close() error
- func (p *Pbft) CurrentBlock() *types.Block
- func (p *Pbft) DecryptArbiter(cipher []byte) (arbiter []byte, err error)
- func (p *Pbft) DoRecover()
- func (p *Pbft) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...)
- func (p *Pbft) FinalizeAndAssemble(chain consensus.ChainReader, header *types.Header, state *state.StateDB, ...) (*types.Block, error)
- func (p *Pbft) GetActivePeersCount() int
- func (p *Pbft) GetAllArbiterPeersInfo() []*p2p.PeerInfo
- func (p *Pbft) GetAtbiterPeersInfo() []peerInfo
- func (p *Pbft) GetBlockByHeight(height uint64) *types.Block
- func (p *Pbft) GetBlockChain() *core.BlockChain
- func (p *Pbft) GetBridgeArbiters() crypto.Keypair
- func (p *Pbft) GetCurrentProducers() [][]byte
- func (p *Pbft) GetDataDir() string
- func (p *Pbft) GetDposAccount() daccount.Account
- func (p *Pbft) GetMainChainHeight(pid peer.PID) uint64
- func (p *Pbft) GetPbftConfig() params.PbftConfig
- func (p *Pbft) GetProducer() []byte
- func (p *Pbft) GetSelfDutyIndex() int
- func (p *Pbft) GetTimeSource() dtime.MedianTimeSource
- func (p *Pbft) GetTotalArbitersCount() int
- func (p *Pbft) GetTotalProducerCount() int
- func (p *Pbft) HasProducerMajorityCount(count int) bool
- func (p *Pbft) IsBadBlock(height uint64) bool
- func (p *Pbft) IsCurrentProducers(curProducers [][]byte) bool
- func (p *Pbft) IsInBlockPool(hash common.Hash) bool
- func (p *Pbft) IsOnDuty() bool
- func (p *Pbft) IsOnduty() bool
- func (p *Pbft) IsProducer() bool
- func (p *Pbft) IsProducerByAccount(account []byte) bool
- func (p *Pbft) IsSameProducers(curProducers [][]byte) bool
- func (p *Pbft) IsSyncFinished() bool
- func (p *Pbft) OnBadNetwork()
- func (p *Pbft) OnBlock(id peer.PID, block *dmsg.BlockMsg)
- func (p *Pbft) OnBlockReceived(id peer.PID, b *dmsg.BlockMsg, confirmed bool)
- func (p *Pbft) OnChangeView()
- func (p *Pbft) OnConfirmReceived(pid peer.PID, c *payload.Confirm, height uint64)
- func (p *Pbft) OnFailedWithdrawTxReceived(id peer.PID, msg *dmsg.FailedWithdrawTx)
- func (p *Pbft) OnGetBlock(id peer.PID, blockHash elacom.Uint256)
- func (p *Pbft) OnGetBlocks(id peer.PID, startBlockHeight, endBlockHeight uint32)
- func (p *Pbft) OnIllegalProposalReceived(id peer.PID, proposals *payload.DPOSIllegalProposals)
- func (p *Pbft) OnIllegalVotesReceived(id peer.PID, votes *payload.DPOSIllegalVotes)
- func (p *Pbft) OnInsertBlock(block *types.Block) bool
- func (p *Pbft) OnInv(id peer.PID, blockHash elacom.Uint256)
- func (p *Pbft) OnLayer2Msg(id dpeer.PID, c elap2p.Message)
- func (p *Pbft) OnPing(id peer.PID, height uint32)
- func (p *Pbft) OnPong(id peer.PID, height uint32)
- func (p *Pbft) OnProposalReceived(id peer.PID, proposal *payload.DPOSProposal)
- func (p *Pbft) OnRecover()
- func (p *Pbft) OnRecoverTimeout()
- func (p *Pbft) OnRequestConsensus(id peer.PID, height uint64)
- func (p *Pbft) OnRequestProposal(id peer.PID, hash elacom.Uint256)
- func (p *Pbft) OnResponseBlocks(id peer.PID, blockConfirms []*dmsg.BlockMsg)
- func (p *Pbft) OnResponseConsensus(id peer.PID, status *dmsg.ConsensusStatus)
- func (p *Pbft) OnResponseResetViewReceived(msg *msg.ResetView)
- func (p *Pbft) OnSmallCroTxReceived(id peer.PID, msg *dmsg.SmallCroTx)
- func (p *Pbft) OnViewChanged(isOnDuty bool, force bool)
- func (p *Pbft) OnVoteAccepted(id peer.PID, vote *payload.DPOSProposalVote)
- func (p *Pbft) OnVoteRejected(id peer.PID, vote *payload.DPOSProposalVote)
- func (p *Pbft) Prepare(chain consensus.ChainReader, header *types.Header) error
- func (p *Pbft) Recover()
- func (p *Pbft) RequestAbnormalRecovering()
- func (p *Pbft) Seal(chain consensus.ChainReader, block *types.Block, results chan<- *types.Block, ...) error
- func (p *Pbft) SealHash(header *types.Header) common.Hash
- func (p *Pbft) SendMsgProposal(proposalMsg elap2p.Message)
- func (p *Pbft) SendMsgToPeer(proposalMsg elap2p.Message, pid dpeer.PID)
- func (p *Pbft) SetBlockChain(chain *core.BlockChain)
- func (p *Pbft) SignData(data []byte) []byte
- func (p *Pbft) SignersCount() int
- func (p *Pbft) Start(headerTime uint64)
- func (p *Pbft) StartProposal(block *types.Block) (*payload.DPOSProposal, error)
- func (p *Pbft) StartServer()
- func (p *Pbft) StopServer()
- func (p *Pbft) UpdateCurrentProducers(producers [][]byte, totalCount int, spvHeight uint64)
- func (p *Pbft) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error
- func (p *Pbft) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)
- func (p *Pbft) VerifySeal(chain consensus.ChainReader, header *types.Header) error
- func (p *Pbft) VerifyUncles(chain consensus.ChainReader, block *types.Block) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidTimestamp is returned if the timestamp of a block is lower than // the previous block's timestamp + the minimum block period. ErrInvalidTimestamp = errors.New("invalid timestamp") ErrAlreadyConfirmedBlock = errors.New("already confirmed block") ErrWaitSyncBlock = errors.New("has confirmed, wait sync block") ErrInvalidConfirm = errors.New("invalid confirm") ErrSignerNotOnduty = errors.New("singer is not on duty") ErrConsensusIsRunning = errors.New("current consensus is running") ErrWaitRecoverStatus = errors.New("wait for recoved states") )
Functions ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API is a user facing RPC API to allow controlling the signer and voting mechanisms of the delegate-proof-of-stake scheme.
func (*API) AnnounceDAddr ¶
func (*API) Dispatcher ¶
func (a *API) Dispatcher() *dpos.Dispatcher
func (*API) GetAllPeersInfo ¶ added in v0.2.0
func (a *API) GetAllPeersInfo() []peerInfo
func (*API) GetAtbiterPeersInfo ¶
func (a *API) GetAtbiterPeersInfo() []peerInfo
type Pbft ¶
type Pbft struct { // IsCurrent returns whether BlockChain synced to best height. IsCurrent func() bool StartMine func() OnDuty func() OnInsertChainError func(id peer.PID, block *types.Block, err error) // contains filtered or unexported fields }
Pbft is a consensus engine based on Byzantine fault-tolerant algorithm
func (*Pbft) AccessFutureBlock ¶
func (*Pbft) AnnounceDAddr ¶
func (*Pbft) BroadMessage ¶ added in v0.1.4
func (*Pbft) BroadMessageExcept ¶ added in v0.2.5
func (*Pbft) BroadMessageToPeers ¶ added in v0.2.0
func (*Pbft) CalcDifficulty ¶
func (*Pbft) CleanFinalConfirmedBlock ¶
func (*Pbft) CurrentBlock ¶ added in v0.2.0
func (*Pbft) DecryptArbiter ¶ added in v0.2.0
func (*Pbft) FinalizeAndAssemble ¶
func (*Pbft) GetActivePeersCount ¶
func (*Pbft) GetAllArbiterPeersInfo ¶ added in v0.2.0
func (*Pbft) GetAtbiterPeersInfo ¶
func (p *Pbft) GetAtbiterPeersInfo() []peerInfo
func (*Pbft) GetBlockByHeight ¶ added in v0.2.0
func (*Pbft) GetBlockChain ¶ added in v0.2.0
func (p *Pbft) GetBlockChain() *core.BlockChain
func (*Pbft) GetBridgeArbiters ¶ added in v0.2.0
func (*Pbft) GetCurrentProducers ¶ added in v0.1.4
func (*Pbft) GetDataDir ¶
func (*Pbft) GetDposAccount ¶ added in v0.2.0
func (*Pbft) GetMainChainHeight ¶ added in v0.2.1
func (*Pbft) GetPbftConfig ¶
func (p *Pbft) GetPbftConfig() params.PbftConfig
func (*Pbft) GetProducer ¶ added in v0.2.0
func (*Pbft) GetSelfDutyIndex ¶ added in v0.2.0
func (*Pbft) GetTimeSource ¶
func (p *Pbft) GetTimeSource() dtime.MedianTimeSource
func (*Pbft) GetTotalArbitersCount ¶ added in v0.2.0
func (*Pbft) GetTotalProducerCount ¶ added in v0.2.0
func (*Pbft) HasProducerMajorityCount ¶ added in v0.2.0
func (*Pbft) IsBadBlock ¶
func (*Pbft) IsCurrentProducers ¶ added in v0.1.4
func (*Pbft) IsProducer ¶
func (*Pbft) IsProducerByAccount ¶ added in v0.2.0
func (*Pbft) IsSameProducers ¶ added in v0.1.4
func (*Pbft) IsSyncFinished ¶ added in v0.2.0
func (*Pbft) OnBadNetwork ¶
func (p *Pbft) OnBadNetwork()
func (*Pbft) OnBlockReceived ¶
func (*Pbft) OnChangeView ¶
func (p *Pbft) OnChangeView()
func (*Pbft) OnConfirmReceived ¶
func (*Pbft) OnFailedWithdrawTxReceived ¶ added in v0.1.4
func (p *Pbft) OnFailedWithdrawTxReceived(id peer.PID, msg *dmsg.FailedWithdrawTx)
func (*Pbft) OnGetBlocks ¶
func (*Pbft) OnIllegalProposalReceived ¶
func (p *Pbft) OnIllegalProposalReceived(id peer.PID, proposals *payload.DPOSIllegalProposals)
func (*Pbft) OnIllegalVotesReceived ¶
func (p *Pbft) OnIllegalVotesReceived(id peer.PID, votes *payload.DPOSIllegalVotes)
func (*Pbft) OnLayer2Msg ¶ added in v0.2.0
func (*Pbft) OnProposalReceived ¶
func (p *Pbft) OnProposalReceived(id peer.PID, proposal *payload.DPOSProposal)
func (*Pbft) OnRecoverTimeout ¶
func (p *Pbft) OnRecoverTimeout()
func (*Pbft) OnResponseBlocks ¶
func (*Pbft) OnResponseConsensus ¶
func (p *Pbft) OnResponseConsensus(id peer.PID, status *dmsg.ConsensusStatus)
func (*Pbft) OnResponseResetViewReceived ¶ added in v0.2.1
func (*Pbft) OnSmallCroTxReceived ¶ added in v0.1.4
func (p *Pbft) OnSmallCroTxReceived(id peer.PID, msg *dmsg.SmallCroTx)
func (*Pbft) OnViewChanged ¶
func (*Pbft) OnVoteAccepted ¶
func (p *Pbft) OnVoteAccepted(id peer.PID, vote *payload.DPOSProposalVote)
func (*Pbft) OnVoteRejected ¶
func (p *Pbft) OnVoteRejected(id peer.PID, vote *payload.DPOSProposalVote)
func (*Pbft) RequestAbnormalRecovering ¶
func (p *Pbft) RequestAbnormalRecovering()
func (*Pbft) SendMsgProposal ¶ added in v0.2.0
func (*Pbft) SendMsgToPeer ¶ added in v0.2.0
func (*Pbft) SetBlockChain ¶
func (p *Pbft) SetBlockChain(chain *core.BlockChain)
func (*Pbft) SignersCount ¶
func (*Pbft) StartProposal ¶
func (*Pbft) StartServer ¶
func (p *Pbft) StartServer()
func (*Pbft) StopServer ¶
func (p *Pbft) StopServer()
func (*Pbft) UpdateCurrentProducers ¶ added in v0.1.4
func (*Pbft) VerifyHeader ¶
func (*Pbft) VerifyHeaders ¶
func (*Pbft) VerifySeal ¶
func (*Pbft) VerifyUncles ¶
Click to show internal directories.
Click to hide internal directories.