custom

package
v0.0.0-...-5104f13 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: MIT Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ICommittee

type ICommittee interface {
	IP2P
	GetValidatorList() []message.PubKey
	GetValidator(key message.PubKey) IPubValidator
	IsValidator(key message.PubKey) bool
	TotalVotingPower() int64
	GetValidatorNum() int

	GetCurrentProposer(round int) message.PubKey
	// DecidesProposal decides what will be proposed if this validator is the current
	// proposer.
	DecidesProposal() message.ProposedData

	// ValidateProposed validates the proposed data
	ValidateProposal(data message.ProposedData) bool

	// Commit defines the actions the users taken when consensus is reached
	// @commitRecords is the +2/3 maj evidence generated by the validator
	Commit(commitRecords *message.Commit) error

	GetAppState() *message.AppState

	GetCommitHistory(height int64) *message.Commit
}

ICommittee represents a validator group which contains all validators at a certain height.

type IP2P

type IP2P interface {
	// BroadCast sends msg to other validators
	BroadCast(msg message.ConsensusMessage) error
	Send(msg message.ConsensusMessage, p IPeer) error
}

type IPeer

type IPeer interface {
	IPv4() string
	Port() uint16
}

type IPrivValidator

type IPrivValidator interface {
	GetPubKey() message.PubKey
	Sign(digest []byte) []byte
}

IPrivValidator signs a message

type IPubValidator

type IPubValidator interface {
	VerifySig(digest, signature []byte) bool
	GetPubKey() message.PubKey
	GetVotingPower() int64
	SetVotingPower(int64)
}

IPubValidator verifies if a message is properly signed by the right validator

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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