olconsensus

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 14 Imported by: 10

Documentation

Overview

Copyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Copyright (c) 2018 The MATRIX Authors Distributed under the MIT software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainReader

type ChainReader interface {
	DPOSEngine(version []byte) consensus.DPOSEngine
	CurrentBlock() *types.Block
}

type DPosVoteRing

type DPosVoteRing struct {
	DPosVoteS []*DPosVoteState
	// contains filtered or unexported fields
}

func NewDPosVoteRing

func NewDPosVoteRing(capacity int) *DPosVoteRing

type DPosVoteState

type DPosVoteState struct {
	Hash             common.Hash
	Proposal         interface{}
	Voted            bool //本地是否对请求投过票
	AffirmativeVotes []voteInfo
	// contains filtered or unexported fields
}

type MessageCenterInterface

type MessageCenterInterface interface {
	SubscribeEvent(aim mc.EventCode, ch interface{}) (event.Subscription, error)
	PublishEvent(aim mc.EventCode, data interface{}) error
}

type MessageSendInterface

type MessageSendInterface interface {
	SendNodeMsg(subCode mc.EventCode, msg interface{}, Roles common.RoleType, address []common.Address)
}

type NodeOnLineInfo

type NodeOnLineInfo struct {
	Address     common.Address
	Role        common.RoleType
	OnlineState []uint8
}

type StateReaderInterface

type StateReaderInterface interface {
	GetTopologyGraphByHash(blockHash common.Hash) (*mc.TopologyGraph, error)
	GetElectOnlineStateByHash(blockHash common.Hash) (*mc.ElectOnlineStatus, error)
}

type TopNodeInstance

type TopNodeInstance struct {
	// contains filtered or unexported fields
}

//////////////////////////////////////////////////////////////////

func NewTopNodeInstance

func NewTopNodeInstance(sh *signhelper.SignHelper, hd *msgsend.HD) *TopNodeInstance

func (*TopNodeInstance) GetTopNodeOnlineState

func (self *TopNodeInstance) GetTopNodeOnlineState() []NodeOnLineInfo

func (*TopNodeInstance) IsSelfAddress

func (self *TopNodeInstance) IsSelfAddress(addr common.Address) bool

func (*TopNodeInstance) PublishEvent

func (self *TopNodeInstance) PublishEvent(aim mc.EventCode, data interface{}) error

func (*TopNodeInstance) SendNodeMsg

func (self *TopNodeInstance) SendNodeMsg(subCode mc.EventCode, msg interface{}, Roles common.RoleType, address []common.Address)

func (*TopNodeInstance) SignWithValidate

func (self *TopNodeInstance) SignWithValidate(hash []byte, validate bool, blkhash common.Hash) (sig common.Signature, err error)

func (*TopNodeInstance) SubscribeEvent

func (self *TopNodeInstance) SubscribeEvent(aim mc.EventCode, ch interface{}) (event.Subscription, error)

type TopNodeService

type TopNodeService struct {
	// contains filtered or unexported fields
}

func NewTopNodeService

func NewTopNodeService(cr ChainReader) *TopNodeService

func (*TopNodeService) Close

func (serv *TopNodeService) Close()

func (*TopNodeService) GetConsensusOnlineResults

func (serv *TopNodeService) GetConsensusOnlineResults() []*mc.HD_OnlineConsensusVoteResultMsg

提供需要上区块头的顶点共识结果,只有leader调用

func (*TopNodeService) LeaderChangeNotifyHandler

func (serv *TopNodeService) LeaderChangeNotifyHandler(leader common.Address)

func (*TopNodeService) OnlineConsensusVoteResultMsgHandler

func (serv *TopNodeService) OnlineConsensusVoteResultMsgHandler(msg *mc.HD_OnlineConsensusVoteResultMsg)

func (*TopNodeService) SetMessageCenterInterface

func (serv *TopNodeService) SetMessageCenterInterface(inter MessageCenterInterface)

func (*TopNodeService) SetMessageSendInterface

func (serv *TopNodeService) SetMessageSendInterface(inter MessageSendInterface)

func (*TopNodeService) SetStateReaderInterface

func (serv *TopNodeService) SetStateReaderInterface(inter StateReaderInterface)

func (*TopNodeService) SetTopNodeStateInterface

func (serv *TopNodeService) SetTopNodeStateInterface(inter TopNodeStateInterface)

func (*TopNodeService) SetValidatorAccountInterface

func (serv *TopNodeService) SetValidatorAccountInterface(inter ValidatorAccountInterface)

func (*TopNodeService) SetValidatorReader

func (serv *TopNodeService) SetValidatorReader(reader consensus.StateReader)

func (*TopNodeService) Start

func (serv *TopNodeService) Start() error

type TopNodeStateInterface

type TopNodeStateInterface interface {
	GetTopNodeOnlineState() []NodeOnLineInfo
}

type ValidatorAccountInterface

type ValidatorAccountInterface interface {
	SignWithValidate(hash []byte, validate bool, blkhash common.Hash) (sig common.Signature, err error)
	IsSelfAddress(addr common.Address) bool
}

Jump to

Keyboard shortcuts

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