Documentation ¶
Index ¶
- type CurrentState
- func (c *CurrentState) AddCommitted(msg *proto.MessageReq)
- func (c *CurrentState) AddMessage(msg *proto.MessageReq)
- func (c *CurrentState) AddPostCommitted(msg *proto.MessageReq)
- func (c *CurrentState) AddPrepared(msg *proto.MessageReq)
- func (c *CurrentState) AddRoundMessage(msg *proto.MessageReq) int
- func (c *CurrentState) Block() *types.Block
- func (c *CurrentState) CalcNeedPunished(currentRound uint64, lastBlockProposer types.Address) (addr []types.Address)
- func (c *CurrentState) CalcProposer(lastProposer types.Address)
- func (c *CurrentState) CanonicalSeal() *proto.MessageReq
- func (c *CurrentState) CleanRound(round uint64)
- func (c *CurrentState) Clear(height uint64)
- func (c *CurrentState) Committed() map[types.Address]*proto.MessageReq
- func (c *CurrentState) ConsumeErr() error
- func (c *CurrentState) GetState() IbftState
- func (c *CurrentState) HandleErr(err error)
- func (c *CurrentState) IsLocked() bool
- func (c *CurrentState) Lock()
- func (c *CurrentState) MaxFaultyNodes() int
- func (c *CurrentState) MaxRound() (maxRound uint64, found bool)
- func (c *CurrentState) MessageTimeout() time.Duration
- func (c *CurrentState) NextRound() uint64
- func (c *CurrentState) NumCommitted() int
- func (c *CurrentState) NumPrepared() int
- func (c *CurrentState) NumValid() int
- func (c *CurrentState) PeekError() error
- func (c *CurrentState) Proposer() types.Address
- func (c *CurrentState) ResetRoundMsgs()
- func (c *CurrentState) Round() uint64
- func (c *CurrentState) Sequence() uint64
- func (c *CurrentState) SetAdditionalTimeout(d time.Duration)
- func (c *CurrentState) SetBlock(b *types.Block)
- func (c *CurrentState) SetState(s IbftState)
- func (c *CurrentState) SetValidators(validators []types.Address)
- func (c *CurrentState) SetView(view *proto.View)
- func (c *CurrentState) Unlock()
- func (c *CurrentState) Validators() []types.Address
- func (c *CurrentState) View() *proto.View
- type IbftState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurrentState ¶
type CurrentState struct {
// contains filtered or unexported fields
}
CurrentState defines the current state object in IBFT
NOTE: not thread safe, better to wrap it in mutext for concurrent use case
func NewState ¶
func NewState() *CurrentState
NewState creates a new state with reset round messages
func (*CurrentState) AddCommitted ¶
func (c *CurrentState) AddCommitted(msg *proto.MessageReq)
AddCommitted adds a committed message
func (*CurrentState) AddMessage ¶
func (c *CurrentState) AddMessage(msg *proto.MessageReq)
AddMessage adds a new message to one of the following message lists: committed, prepared, roundMessages
func (*CurrentState) AddPostCommitted ¶ added in v1.2.1
func (c *CurrentState) AddPostCommitted(msg *proto.MessageReq)
func (*CurrentState) AddPrepared ¶
func (c *CurrentState) AddPrepared(msg *proto.MessageReq)
AddPrepared adds a prepared message
func (*CurrentState) AddRoundMessage ¶
func (c *CurrentState) AddRoundMessage(msg *proto.MessageReq) int
AddRoundMessage adds a message to the round, and returns the round message size
func (*CurrentState) Block ¶
func (c *CurrentState) Block() *types.Block
func (*CurrentState) CalcNeedPunished ¶
func (*CurrentState) CalcProposer ¶
func (c *CurrentState) CalcProposer(lastProposer types.Address)
CalcProposer calculates the proposer and sets it to the state
func (*CurrentState) CanonicalSeal ¶ added in v1.2.1
func (c *CurrentState) CanonicalSeal() *proto.MessageReq
func (*CurrentState) CleanRound ¶
func (c *CurrentState) CleanRound(round uint64)
CleanRound deletes the specific round messages
func (*CurrentState) Clear ¶ added in v1.2.1
func (c *CurrentState) Clear(height uint64)
func (*CurrentState) Committed ¶
func (c *CurrentState) Committed() map[types.Address]*proto.MessageReq
func (*CurrentState) ConsumeErr ¶
func (c *CurrentState) ConsumeErr() error
ConsumeErr returns the current error, if any, and consumes it
func (*CurrentState) GetState ¶
func (c *CurrentState) GetState() IbftState
GetState returns the current state
func (*CurrentState) HandleErr ¶
func (c *CurrentState) HandleErr(err error)
func (*CurrentState) IsLocked ¶
func (c *CurrentState) IsLocked() bool
func (*CurrentState) Lock ¶
func (c *CurrentState) Lock()
func (*CurrentState) MaxFaultyNodes ¶
func (c *CurrentState) MaxFaultyNodes() int
func (*CurrentState) MaxRound ¶
func (c *CurrentState) MaxRound() (maxRound uint64, found bool)
func (*CurrentState) MessageTimeout ¶
func (c *CurrentState) MessageTimeout() time.Duration
MessageTimeout returns duration for waiting message
Consider the network travel time between most validators, using validator numbers instead of rounds.
func (*CurrentState) NextRound ¶
func (c *CurrentState) NextRound() uint64
func (*CurrentState) NumCommitted ¶
func (c *CurrentState) NumCommitted() int
numCommitted returns the number of messages in the committed message list
func (*CurrentState) NumPrepared ¶
func (c *CurrentState) NumPrepared() int
NumPrepared returns the number of messages in the prepared message list
func (*CurrentState) NumValid ¶
func (c *CurrentState) NumValid() int
NumValid returns the number of required messages
func (*CurrentState) PeekError ¶
func (c *CurrentState) PeekError() error
func (*CurrentState) Proposer ¶
func (c *CurrentState) Proposer() types.Address
func (*CurrentState) ResetRoundMsgs ¶
func (c *CurrentState) ResetRoundMsgs()
ResetRoundMsgs resets the prepared, committed and round messages in the current state
func (*CurrentState) Round ¶
func (c *CurrentState) Round() uint64
func (*CurrentState) Sequence ¶
func (c *CurrentState) Sequence() uint64
func (*CurrentState) SetAdditionalTimeout ¶ added in v1.2.1
func (c *CurrentState) SetAdditionalTimeout(d time.Duration)
SetAdditionalTimeout sets an additional timeout for potentially long builds
func (*CurrentState) SetBlock ¶
func (c *CurrentState) SetBlock(b *types.Block)
func (*CurrentState) SetState ¶
func (c *CurrentState) SetState(s IbftState)
SetState sets the current state
func (*CurrentState) SetValidators ¶
func (c *CurrentState) SetValidators(validators []types.Address)
func (*CurrentState) SetView ¶
func (c *CurrentState) SetView(view *proto.View)
func (*CurrentState) Unlock ¶
func (c *CurrentState) Unlock()
func (*CurrentState) Validators ¶
func (c *CurrentState) Validators() []types.Address
func (*CurrentState) View ¶
func (c *CurrentState) View() *proto.View