Documentation ¶
Index ¶
- Constants
- Variables
- type BroadcastMessenger
- type ChronologyHandler
- type HeadersPoolSubscriber
- type InterceptorSubscriber
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (this *Message) Equal(that interface{}) bool
- func (m *Message) GetAggregateSignature() []byte
- func (m *Message) GetBlockHeaderHash() []byte
- func (m *Message) GetBody() []byte
- func (m *Message) GetChainID() []byte
- func (m *Message) GetHeader() []byte
- func (m *Message) GetLeaderSignature() []byte
- func (m *Message) GetMsgType() int64
- func (m *Message) GetOriginatorPid() []byte
- func (m *Message) GetPubKey() []byte
- func (m *Message) GetPubKeysBitmap() []byte
- func (m *Message) GetRoundIndex() int64
- func (m *Message) GetSignature() []byte
- func (m *Message) GetSignatureShare() []byte
- func (this *Message) GoString() string
- func (m *Message) Marshal() (dAtA []byte, err error)
- func (m *Message) MarshalTo(dAtA []byte) (int, error)
- func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) Size() (n int)
- func (this *Message) String() string
- func (m *Message) Unmarshal(dAtA []byte) error
- func (m *Message) XXX_DiscardUnknown()
- func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Message) XXX_Merge(src proto.Message)
- func (m *Message) XXX_Size() int
- func (m *Message) XXX_Unmarshal(b []byte) error
- type MessageType
- type NetworkShardingCollector
- type P2PAntifloodHandler
- type P2PMessenger
- type PeerHonestyHandler
- type Rounder
- type SubroundHandler
Constants ¶
const BlsConsensusType = "bls"
BlsConsensusType specifies the signature scheme used in the consensus
Variables ¶
Functions ¶
This section is empty.
Types ¶
type BroadcastMessenger ¶
type BroadcastMessenger interface { BroadcastBlock(data.BodyHandler, data.HeaderHandler) error BroadcastHeader(data.HeaderHandler) error BroadcastMiniBlocks(map[uint32][]byte) error BroadcastTransactions(map[string][][]byte) error BroadcastConsensusMessage(*Message) error BroadcastBlockDataLeader(header data.HeaderHandler, miniBlocks map[uint32][]byte, transactions map[string][][]byte) error PrepareBroadcastHeaderValidator(header data.HeaderHandler, miniBlocks map[uint32][]byte, transactions map[string][][]byte, order int) PrepareBroadcastBlockDataValidator(header data.HeaderHandler, miniBlocks map[uint32][]byte, transactions map[string][][]byte, idx int) IsInterfaceNil() bool }
BroadcastMessenger defines the behaviour of the broadcast messages by the consensus group
type ChronologyHandler ¶
type ChronologyHandler interface { Close() error AddSubround(SubroundHandler) RemoveAllSubrounds() // StartRounds starts rounds in a sequential manner, one after the other StartRounds() IsInterfaceNil() bool }
ChronologyHandler defines the actions which should be handled by a chronology implementation
type HeadersPoolSubscriber ¶
type HeadersPoolSubscriber interface { RegisterHandler(handler func(headerHandler data.HeaderHandler, headerHash []byte)) IsInterfaceNil() bool }
HeadersPoolSubscriber can subscribe for notifications when a new block header is added to the headers pool
type InterceptorSubscriber ¶
type InterceptorSubscriber interface { RegisterHandler(handler func(toShard uint32, data []byte)) IsInterfaceNil() bool }
InterceptorSubscriber can subscribe for notifications when data is received by an interceptor
type Message ¶
type Message struct { BlockHeaderHash []byte `protobuf:"bytes,1,opt,name=BlockHeaderHash,proto3" json:"BlockHeaderHash,omitempty"` Body []byte `protobuf:"bytes,3,opt,name=Body,proto3" json:"Body,omitempty"` Header []byte `protobuf:"bytes,4,opt,name=Header,proto3" json:"Header,omitempty"` PubKey []byte `protobuf:"bytes,5,opt,name=PubKey,proto3" json:"PubKey,omitempty"` Signature []byte `protobuf:"bytes,6,opt,name=Signature,proto3" json:"Signature,omitempty"` MsgType int64 `protobuf:"varint,7,opt,name=MsgType,proto3" json:"MsgType,omitempty"` RoundIndex int64 `protobuf:"varint,8,opt,name=RoundIndex,proto3" json:"RoundIndex,omitempty"` ChainID []byte `protobuf:"bytes,9,opt,name=ChainID,proto3" json:"ChainID,omitempty"` PubKeysBitmap []byte `protobuf:"bytes,10,opt,name=PubKeysBitmap,proto3" json:"PubKeysBitmap,omitempty"` AggregateSignature []byte `protobuf:"bytes,11,opt,name=AggregateSignature,proto3" json:"AggregateSignature,omitempty"` LeaderSignature []byte `protobuf:"bytes,12,opt,name=LeaderSignature,proto3" json:"LeaderSignature,omitempty"` OriginatorPid []byte `protobuf:"bytes,13,opt,name=OriginatorPid,proto3" json:"OriginatorPid,omitempty"` }
Message defines the data needed by spos to communicate between nodes over network in all subrounds
func NewConsensusMessage ¶
func NewConsensusMessage( blHeaderHash []byte, signatureShare []byte, body []byte, header []byte, pubKey []byte, sig []byte, msg int, roundIndex int64, chainID []byte, pubKeysBitmap []byte, aggregateSignature []byte, leaderSignature []byte, currentPid core.PeerID, ) *Message
NewConsensusMessage creates a new Message object
func (*Message) Descriptor ¶
func (*Message) GetAggregateSignature ¶
func (*Message) GetBlockHeaderHash ¶
func (*Message) GetChainID ¶
func (*Message) GetLeaderSignature ¶
func (*Message) GetMsgType ¶
func (*Message) GetOriginatorPid ¶
func (*Message) GetPubKeysBitmap ¶
func (*Message) GetRoundIndex ¶
func (*Message) GetSignature ¶
func (*Message) GetSignatureShare ¶
func (*Message) MarshalToSizedBuffer ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) XXX_DiscardUnknown ¶
func (m *Message) XXX_DiscardUnknown()
func (*Message) XXX_Marshal ¶
func (*Message) XXX_Unmarshal ¶
type NetworkShardingCollector ¶
type NetworkShardingCollector interface { UpdatePeerIdPublicKey(pid core.PeerID, pk []byte) UpdatePublicKeyShardId(pk []byte, shardId uint32) UpdatePeerIdShardId(pid core.PeerID, shardId uint32) GetPeerInfo(pid core.PeerID) core.P2PPeerInfo IsInterfaceNil() bool }
NetworkShardingCollector defines the updating methods used by the network sharding component The interface assures that the collected data will be used by the p2p network sharding components
type P2PAntifloodHandler ¶
type P2PAntifloodHandler interface { CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error CanProcessMessagesOnTopic(peer core.PeerID, topic string, numMessages uint32, totalSize uint64, sequence []byte) error ResetForTopic(topic string) SetMaxMessagesForTopic(topic string, maxNum uint32) BlacklistPeer(peer core.PeerID, reason string, duration time.Duration) IsInterfaceNil() bool }
P2PAntifloodHandler defines the behavior of a component able to signal that the system is too busy (or flooded) processing p2p messages
type P2PMessenger ¶
P2PMessenger defines a subset of the p2p.Messenger interface
type PeerHonestyHandler ¶
type PeerHonestyHandler interface { ChangeScore(pk string, topic string, units int) IsInterfaceNil() bool }
PeerHonestyHandler defines the behaivour of a component able to handle/monitor the peer honesty of nodes which are participating in consensus
type Rounder ¶
type Rounder interface { Index() int64 BeforeGenesis() bool // UpdateRound updates the index and the time stamp of the round depending of the genesis time and the current time given UpdateRound(time.Time, time.Time) TimeStamp() time.Time TimeDuration() time.Duration RemainingTime(startTime time.Time, maxTime time.Duration) time.Duration IsInterfaceNil() bool }
Rounder defines the actions which should be handled by a round implementation
type SubroundHandler ¶
type SubroundHandler interface { // DoWork implements of the subround's job DoWork(rounder Rounder) bool // Previous returns the ID of the previous subround Previous() int // Next returns the ID of the next subround Next() int // Current returns the ID of the current subround Current() int // StartTime returns the start time, in the rounder time, of the current subround StartTime() int64 // EndTime returns the top limit time, in the rounder time, of the current subround EndTime() int64 // Name returns the name of the current rounder Name() string // ConsensusChannel returns the consensus channel ConsensusChannel() chan bool // IsInterfaceNil returns true if there is no value under the interface IsInterfaceNil() bool }
SubroundHandler defines the actions which should be handled by a subround implementation