Documentation ¶
Index ¶
- Constants
- func RegisterMessages(cdc *amino.Codec)
- func RegisterMockEvidences()
- type ErrEvidenceAlreadyStored
- type ErrInvalidEvidence
- type Info
- type ListMessage
- type Message
- type PeerState
- type Pool
- func (evpool *Pool) AddEvidence(evidence types.Evidence) error
- func (evpool *Pool) EvidenceFront() *clist.CElement
- func (evpool *Pool) EvidenceWaitChan() <-chan struct{}
- func (evpool *Pool) IsCommitted(evidence types.Evidence) bool
- func (evpool *Pool) MarkEvidenceAsCommitted(height int64, lastBlockTime time.Time, evidence []types.Evidence)
- func (evpool *Pool) PendingEvidence(maxNum int64) []types.Evidence
- func (evpool *Pool) PriorityEvidence() []types.Evidence
- func (evpool *Pool) SetLogger(l log.Logger)
- func (evpool *Pool) State() sm.State
- func (evpool *Pool) Update(block *types.Block, state sm.State)
- type Reactor
- type Store
- func (store *Store) AddNewEvidence(evidence types.Evidence, priority int64) (bool, error)
- func (store *Store) GetInfo(height int64, hash []byte) Info
- func (store *Store) Has(evidence types.Evidence) bool
- func (store *Store) MarkEvidenceAsBroadcasted(evidence types.Evidence)
- func (store *Store) MarkEvidenceAsCommitted(evidence types.Evidence)
- func (store *Store) PendingEvidence(maxNum int64) (evidence []types.Evidence)
- func (store *Store) PriorityEvidence() (evidence []types.Evidence)
Constants ¶
const (
EvidenceChannel = byte(0x38)
)
Variables ¶
This section is empty.
Functions ¶
func RegisterMessages ¶ added in v0.33.0
Types ¶
type ErrEvidenceAlreadyStored ¶ added in v0.33.4
type ErrEvidenceAlreadyStored struct{}
ErrEvidenceAlreadyStored indicates that the evidence has already been stored in the evidence db
func (ErrEvidenceAlreadyStored) Error ¶ added in v0.33.4
func (e ErrEvidenceAlreadyStored) Error() string
type ErrInvalidEvidence ¶ added in v0.33.4
type ErrInvalidEvidence struct {
Reason error
}
ErrInvalidEvidence returns when evidence failed to validate
func (ErrInvalidEvidence) Error ¶ added in v0.33.4
func (e ErrInvalidEvidence) Error() string
type ListMessage ¶ added in v0.33.0
ListMessage contains a list of evidence.
func (*ListMessage) String ¶ added in v0.33.0
func (m *ListMessage) String() string
String returns a string representation of the ListMessage.
func (*ListMessage) ValidateBasic ¶ added in v0.33.0
func (m *ListMessage) ValidateBasic() error
ValidateBasic performs basic validation.
type Message ¶ added in v0.33.0
type Message interface {
ValidateBasic() error
}
Message is a message sent or received by the Reactor.
type PeerState ¶
type PeerState interface {
GetHeight() int64
}
PeerState describes the state of a peer.
type Pool ¶ added in v0.33.0
type Pool struct {
// contains filtered or unexported fields
}
Pool maintains a pool of valid evidence in an Store.
func (*Pool) AddEvidence ¶ added in v0.33.0
AddEvidence checks the evidence is valid and adds it to the pool.
func (*Pool) EvidenceFront ¶ added in v0.33.0
func (*Pool) EvidenceWaitChan ¶ added in v0.33.0
func (evpool *Pool) EvidenceWaitChan() <-chan struct{}
func (*Pool) IsCommitted ¶ added in v0.33.0
IsCommitted returns true if we have already seen this exact evidence and it is already marked as committed.
func (*Pool) MarkEvidenceAsCommitted ¶ added in v0.33.0
func (evpool *Pool) MarkEvidenceAsCommitted(height int64, lastBlockTime time.Time, evidence []types.Evidence)
MarkEvidenceAsCommitted marks all the evidence as committed and removes it from the queue.
func (*Pool) PendingEvidence ¶ added in v0.33.0
PendingEvidence returns up to maxNum uncommitted evidence. If maxNum is -1, all evidence is returned.
func (*Pool) PriorityEvidence ¶ added in v0.33.0
PriorityEvidence returns the priority evidence.
type Reactor ¶ added in v0.33.0
type Reactor struct { p2p.BaseReactor // contains filtered or unexported fields }
Reactor handles evpool evidence broadcasting amongst peers.
func NewReactor ¶ added in v0.33.0
NewReactor returns a new Reactor with the given config and evpool.
func (*Reactor) GetChannels ¶ added in v0.33.0
func (evR *Reactor) GetChannels() []*p2p.ChannelDescriptor
GetChannels implements Reactor. It returns the list of channels for this reactor.
func (*Reactor) Receive ¶ added in v0.33.0
Receive implements Reactor. It adds any received evidence to the evpool.
func (*Reactor) SetEventBus ¶ added in v0.33.0
SetEventBus implements events.Eventable.
type Store ¶ added in v0.33.0
type Store struct {
// contains filtered or unexported fields
}
Store is a store of all the evidence we've seen, including evidence that has been committed, evidence that has been verified but not broadcast, and evidence that has been broadcast but not yet committed.
func (*Store) AddNewEvidence ¶ added in v0.33.0
AddNewEvidence adds the given evidence to the database. It returns false if the evidence is already stored.
func (*Store) GetInfo ¶ added in v0.33.0
GetInfo fetches the Info with the given height and hash. If not found, ei.Evidence is nil.
func (*Store) MarkEvidenceAsBroadcasted ¶ added in v0.33.0
MarkEvidenceAsBroadcasted removes evidence from Outqueue.
func (*Store) MarkEvidenceAsCommitted ¶ added in v0.33.0
MarkEvidenceAsCommitted removes evidence from pending and outqueue and sets the state to committed.
func (*Store) PendingEvidence ¶ added in v0.33.0
PendingEvidence returns up to maxNum known, uncommitted evidence. If maxNum is -1, all evidence is returned.
func (*Store) PriorityEvidence ¶ added in v0.33.0
PriorityEvidence returns the evidence from the outqueue, sorted by highest priority.