Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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[uint32][][]byte) error
BroadcastConsensusMessage(*Message) error
}
BroadcastMessenger defines the behaviour of the broadcast messages by the consensus group
type ChronologyHandler ¶
type ChronologyHandler interface {
AddSubround(SubroundHandler)
RemoveAllSubrounds()
// StartRounds starts rounds in a sequential manner, one after the other
StartRounds()
}
ChronologyHandler defines the actions which should be handled by a chronology implementation
type Message ¶
type Message struct {
BlockHeaderHash []byte
SubRoundData []byte
PubKey []byte
Signature []byte
MsgType int
TimeStamp uint64
RoundIndex int32
}
Message defines the data needed by spos to communicate between nodes over network in all subrounds
type P2PMessenger ¶
P2PMessenger defines a subset of the p2p.Messenger interface
type PublicKeysSelector ¶ added in v1.0.3
type PublicKeysSelector interface {
GetSelectedPublicKeys(selection []byte) (publicKeys []string, err error)
}
PublicKeysSelector allows retrieval of eligible validators public keys selected by a bitmap
type Rounder ¶
type Rounder interface {
Index() int32
// 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
}
Rounder defines the actions which should be handled by a round implementation
type SposFactory ¶
type SposFactory interface {
GenerateSubrounds()
}
SposFactory defines an interface for a consensus 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
}
SubroundHandler defines the actions which should be handled by a subround implementation
type Validator ¶ added in v1.0.3
Validator defines what a consensus validator implementation should do.
type ValidatorGroupSelector ¶ added in v1.0.3
type ValidatorGroupSelector interface {
PublicKeysSelector
LoadEligibleList(eligibleList []Validator) error
ComputeValidatorsGroup(randomness []byte) (validatorsGroup []Validator, err error)
ConsensusGroupSize() int
SetConsensusGroupSize(int) error
}
ValidatorGroupSelector defines the behaviour of a struct able to do validator group selection