Documentation ¶
Index ¶
- Constants
- Variables
- type BroadcastMessenger
- type ChronologyHandler
- type HeadersPoolSubscriber
- 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) 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 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 SetDataForDelayBroadcast(headerHash []byte, miniBlocks map[uint32][]byte, transactions map[string][][]byte) error 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 ¶ added in v1.0.106
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 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"` }
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, ) *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) 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) 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) error ResetForTopic(topic string) SetMaxMessagesForTopic(topic string, maxNum uint32) 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 Rounder ¶
type Rounder interface { Index() int64 // 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