Documentation
¶
Index ¶
- func SetLogging(level logging.Lvl, handler logging.Handler)
- type BallotSendRecord
- type ISAAC
- func (is *ISAAC) CanGetVotingResult(blt ballot.Ballot) (rv RoundVoteResult, vh voting.Hole, finished bool)
- func (is *ISAAC) ConnectionManager() network.ConnectionManager
- func (is *ISAAC) GenerateExpiredBallot(basis voting.Basis, state ballot.State) (ballot.Ballot, error)
- func (is *ISAAC) HasRunningRound(basisIndex string) bool
- func (is *ISAAC) HasSameProposer(b ballot.Ballot) bool
- func (is *ISAAC) IsValidVotingBasis(basis voting.Basis, latestBlock block.Block) bool
- func (is *ISAAC) IsVoted(b ballot.Ballot) bool
- func (is *ISAAC) IsVotedByNode(b ballot.Ballot, node string) (bool, error)
- func (is *ISAAC) LatestBlock() block.Block
- func (is *ISAAC) LatestVotingBasis() voting.Basis
- func (is *ISAAC) RemoveOldBallots(blt ballot.Ballot) (needRenewal bool)
- func (is *ISAAC) RemoveRunningRoundsLowerOrEqualBasis(basis voting.Basis)
- func (is *ISAAC) RemoveRunningRoundsLowerOrEqualHeight(height uint64)
- func (is *ISAAC) SelectProposer(blockHeight uint64, round uint64) string
- func (is *ISAAC) SetLatestVotingBasis(basis voting.Basis)
- func (is *ISAAC) SetProposerSelector(p ProposerSelector)
- func (is *ISAAC) StartSync(height uint64, nodeAddrs []string)
- func (is *ISAAC) Vote(b ballot.Ballot) (isNew bool, err error)
- type ISAACState
- type ISAACVotingThresholdPolicy
- func (vt *ISAACVotingThresholdPolicy) Connected() int
- func (vt *ISAACVotingThresholdPolicy) MarshalJSON() ([]byte, error)
- func (vt *ISAACVotingThresholdPolicy) SetConnected(n int)
- func (vt *ISAACVotingThresholdPolicy) SetValidators(n int)
- func (vt *ISAACVotingThresholdPolicy) Threshold() int
- func (vt *ISAACVotingThresholdPolicy) Validators() int
- type ProposerSelector
- type RoundVote
- func (rv *RoundVote) CanGetVotingResult(policy voting.ThresholdPolicy, state ballot.State, log logging.Logger) (RoundVoteResult, voting.Hole, bool)
- func (rv *RoundVote) GetResult(state ballot.State) (result RoundVoteResult)
- func (rv *RoundVote) IsVoted(ballot ballot.Ballot) bool
- func (rv *RoundVote) IsVotedByNode(state ballot.State, node string) bool
- func (rv *RoundVote) Vote(b ballot.Ballot) (isNew bool, err error)
- type RoundVoteResult
- type RunningRound
- type SequentialSelector
- type SyncController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BallotSendRecord ¶
Record the ballot sent by ISAACstate This is to avoid sending another voting result in the same ISAACState.
func NewBallotSendRecord ¶
func NewBallotSendRecord(nodeAlias string) *BallotSendRecord
func (*BallotSendRecord) InitSent ¶
func (r *BallotSendRecord) InitSent(state ISAACState)
InitSent initializes the ballot transfer record of this ISAACState.InitSent. This function is used when an existing ballot has expired.
func (*BallotSendRecord) RemoveLowerThanOrEqualHeight ¶
func (r *BallotSendRecord) RemoveLowerThanOrEqualHeight(height uint64)
func (*BallotSendRecord) Sent ¶
func (r *BallotSendRecord) Sent(state ISAACState) bool
func (*BallotSendRecord) SetSent ¶
func (r *BallotSendRecord) SetSent(state ISAACState)
SetSent sets that the ballot of this ISAACState has already been sent. This is to prevent one node from retransmitting another result.
type ISAAC ¶
type ISAAC struct { sync.RWMutex LatestBallot ballot.Ballot Node *node.LocalNode RunningRounds map[string]*RunningRound Conf common.Config // contains filtered or unexported fields }
func NewISAAC ¶
func NewISAAC(node *node.LocalNode, p voting.ThresholdPolicy, cm network.ConnectionManager, st *storage.LevelDBBackend, conf common.Config, syncer SyncController) (is *ISAAC, err error)
ISAAC should know network.ConnectionManager because the ISAAC uses connected validators when calculating proposer
func (*ISAAC) CanGetVotingResult ¶
func (*ISAAC) ConnectionManager ¶
func (is *ISAAC) ConnectionManager() network.ConnectionManager
func (*ISAAC) GenerateExpiredBallot ¶
func (is *ISAAC) GenerateExpiredBallot(basis voting.Basis, state ballot.State) (ballot.Ballot, error)
GenerateExpiredBallot create an expired ballot using voting.Basis and ballot.State. This function is used to create a ballot indicating that a node has expired to other nodes when a timeout occurs in the state.
func (*ISAAC) HasRunningRound ¶
func (*ISAAC) IsValidVotingBasis ¶
Check if `basis` is a valid one for the current round of consensus
Params:
basis = `voting.Basis` received for the current round of consensus latestBlock = the latest block known to the node
Returns:
bool = `true` if it's a valid voting basis, `false` otherwise
func (*ISAAC) IsVotedByNode ¶
func (*ISAAC) LatestBlock ¶
func (*ISAAC) LatestVotingBasis ¶
func (*ISAAC) RemoveOldBallots ¶
RemoveOldBallots checks that `blt` has valid confirmed and proposed time. If it is invalid, it is removed. And if the invalid ballot is make by itself, return `needRenewal` = true for rebroadcasting EXP ballot
func (*ISAAC) RemoveRunningRoundsLowerOrEqualBasis ¶
func (*ISAAC) RemoveRunningRoundsLowerOrEqualHeight ¶
func (*ISAAC) SelectProposer ¶
func (*ISAAC) SetLatestVotingBasis ¶
func (*ISAAC) SetProposerSelector ¶
func (is *ISAAC) SetProposerSelector(p ProposerSelector)
type ISAACState ¶
func (ISAACState) IsLater ¶
func (s ISAACState) IsLater(target ISAACState) bool
type ISAACVotingThresholdPolicy ¶
func NewDefaultVotingThresholdPolicy ¶
func NewDefaultVotingThresholdPolicy(threshold int) (vt *ISAACVotingThresholdPolicy, err error)
func (*ISAACVotingThresholdPolicy) Connected ¶
func (vt *ISAACVotingThresholdPolicy) Connected() int
func (*ISAACVotingThresholdPolicy) MarshalJSON ¶
func (vt *ISAACVotingThresholdPolicy) MarshalJSON() ([]byte, error)
func (*ISAACVotingThresholdPolicy) SetConnected ¶
func (vt *ISAACVotingThresholdPolicy) SetConnected(n int)
func (*ISAACVotingThresholdPolicy) SetValidators ¶
func (vt *ISAACVotingThresholdPolicy) SetValidators(n int)
func (*ISAACVotingThresholdPolicy) Threshold ¶
func (vt *ISAACVotingThresholdPolicy) Threshold() int
func (*ISAACVotingThresholdPolicy) Validators ¶
func (vt *ISAACVotingThresholdPolicy) Validators() int
type ProposerSelector ¶
type RoundVote ¶
type RoundVote struct { SIGN RoundVoteResult ACCEPT RoundVoteResult }
func NewRoundVote ¶
func (*RoundVote) CanGetVotingResult ¶
func (*RoundVote) GetResult ¶
func (rv *RoundVote) GetResult(state ballot.State) (result RoundVoteResult)
func (*RoundVote) IsVotedByNode ¶
type RoundVoteResult ¶
type RunningRound ¶
type RunningRound struct { sync.RWMutex VotingBasis voting.Basis Proposer string // LocalNode's `Proposer` Transactions map[string][]string /* Transaction.Hash */ Voted map[string]*RoundVote Ballots []ballot.Ballot }
func NewRunningRound ¶
func NewRunningRound(proposer string, blt ballot.Ballot) (*RunningRound, error)
func (*RunningRound) RoundVote ¶
func (rr *RunningRound) RoundVote(proposer string) (rv *RoundVote, err error)
func (*RunningRound) Vote ¶
func (rr *RunningRound) Vote(ballot ballot.Ballot)
type SequentialSelector ¶
type SequentialSelector struct {
// contains filtered or unexported fields
}