Documentation ¶
Index ¶
- Constants
- func RegisterEvidenceMessages(cdc *amino.Codec)
- func RegisterMockEvidences()
- type EvidenceInfo
- type EvidenceListMessage
- type EvidenceMessage
- type EvidencePool
- func (evpool *EvidencePool) AddEvidence(evidence types.Evidence) (err error)
- func (evpool *EvidencePool) EvidenceFront() *clist.CElement
- func (evpool *EvidencePool) EvidenceWaitChan() <-chan struct{}
- func (evpool *EvidencePool) IsCommitted(evidence types.Evidence) bool
- func (evpool *EvidencePool) MarkEvidenceAsCommitted(height int64, evidence []types.Evidence)
- func (evpool *EvidencePool) PendingEvidence(maxNum int64) []types.Evidence
- func (evpool *EvidencePool) PriorityEvidence() []types.Evidence
- func (evpool *EvidencePool) SetLogger(l log.Logger)
- func (evpool *EvidencePool) State() sm.State
- func (evpool *EvidencePool) Update(block *types.Block, state sm.State)
- type EvidenceReactor
- func (evR *EvidenceReactor) AddPeer(peer p2p.Peer)
- func (evR *EvidenceReactor) GetChannels() []*p2p.ChannelDescriptor
- func (evR *EvidenceReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
- func (evR *EvidenceReactor) RemovePeer(peer p2p.Peer, reason interface{})
- func (evR *EvidenceReactor) SetEventBus(b *types.EventBus)
- func (evR *EvidenceReactor) SetLogger(l log.Logger)
- type EvidenceStore
- func (store *EvidenceStore) AddNewEvidence(evidence types.Evidence, priority int64) bool
- func (store *EvidenceStore) GetEvidenceInfo(height int64, hash []byte) EvidenceInfo
- func (store *EvidenceStore) MarkEvidenceAsBroadcasted(evidence types.Evidence)
- func (store *EvidenceStore) MarkEvidenceAsCommitted(evidence types.Evidence)
- func (store *EvidenceStore) PendingEvidence(maxNum int64) (evidence []types.Evidence)
- func (store *EvidenceStore) PriorityEvidence() (evidence []types.Evidence)
- type PeerState
Constants ¶
const (
EvidenceChannel = byte(0x38)
)
Variables ¶
This section is empty.
Functions ¶
func RegisterEvidenceMessages ¶ added in v0.19.0
func RegisterMockEvidences ¶ added in v0.19.0
func RegisterMockEvidences()
For testing purposes only
Types ¶
type EvidenceInfo ¶
type EvidenceListMessage ¶
EvidenceListMessage contains a list of evidence.
func (*EvidenceListMessage) String ¶
func (m *EvidenceListMessage) String() string
String returns a string representation of the EvidenceListMessage.
func (*EvidenceListMessage) ValidateBasic ¶ added in v0.26.0
func (m *EvidenceListMessage) ValidateBasic() error
ValidateBasic performs basic validation.
type EvidenceMessage ¶
type EvidenceMessage interface {
ValidateBasic() error
}
EvidenceMessage is a message sent or received by the EvidenceReactor.
type EvidencePool ¶
type EvidencePool struct {
// contains filtered or unexported fields
}
EvidencePool maintains a pool of valid evidence in an EvidenceStore.
func NewEvidencePool ¶
func NewEvidencePool(stateDB, evidenceDB dbm.DB) *EvidencePool
func (*EvidencePool) AddEvidence ¶
func (evpool *EvidencePool) AddEvidence(evidence types.Evidence) (err error)
AddEvidence checks the evidence is valid and adds it to the pool.
func (*EvidencePool) EvidenceFront ¶ added in v0.19.9
func (evpool *EvidencePool) EvidenceFront() *clist.CElement
func (*EvidencePool) EvidenceWaitChan ¶ added in v0.19.9
func (evpool *EvidencePool) EvidenceWaitChan() <-chan struct{}
func (*EvidencePool) IsCommitted ¶
func (evpool *EvidencePool) IsCommitted(evidence types.Evidence) bool
IsCommitted returns true if we have already seen this exact evidence and it is already marked as committed.
func (*EvidencePool) MarkEvidenceAsCommitted ¶
func (evpool *EvidencePool) MarkEvidenceAsCommitted(height int64, evidence []types.Evidence)
MarkEvidenceAsCommitted marks all the evidence as committed and removes it from the queue.
func (*EvidencePool) PendingEvidence ¶
func (evpool *EvidencePool) PendingEvidence(maxNum int64) []types.Evidence
PendingEvidence returns up to maxNum uncommitted evidence. If maxNum is -1, all evidence is returned.
func (*EvidencePool) PriorityEvidence ¶
func (evpool *EvidencePool) PriorityEvidence() []types.Evidence
PriorityEvidence returns the priority evidence.
func (*EvidencePool) SetLogger ¶
func (evpool *EvidencePool) SetLogger(l log.Logger)
SetLogger sets the Logger.
func (*EvidencePool) State ¶
func (evpool *EvidencePool) State() sm.State
State returns the current state of the evpool.
type EvidenceReactor ¶
type EvidenceReactor struct { p2p.BaseReactor // contains filtered or unexported fields }
EvidenceReactor handles evpool evidence broadcasting amongst peers.
func NewEvidenceReactor ¶
func NewEvidenceReactor(evpool *EvidencePool) *EvidenceReactor
NewEvidenceReactor returns a new EvidenceReactor with the given config and evpool.
func (*EvidenceReactor) AddPeer ¶
func (evR *EvidenceReactor) AddPeer(peer p2p.Peer)
AddPeer implements Reactor.
func (*EvidenceReactor) GetChannels ¶
func (evR *EvidenceReactor) GetChannels() []*p2p.ChannelDescriptor
GetChannels implements Reactor. It returns the list of channels for this reactor.
func (*EvidenceReactor) Receive ¶
func (evR *EvidenceReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
Receive implements Reactor. It adds any received evidence to the evpool.
func (*EvidenceReactor) RemovePeer ¶
func (evR *EvidenceReactor) RemovePeer(peer p2p.Peer, reason interface{})
RemovePeer implements Reactor.
func (*EvidenceReactor) SetEventBus ¶
func (evR *EvidenceReactor) SetEventBus(b *types.EventBus)
SetEventSwitch implements events.Eventable.
func (*EvidenceReactor) SetLogger ¶
func (evR *EvidenceReactor) SetLogger(l log.Logger)
SetLogger sets the Logger on the reactor and the underlying Evidence.
type EvidenceStore ¶
type EvidenceStore struct {
// contains filtered or unexported fields
}
EvidenceStore 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 NewEvidenceStore ¶
func NewEvidenceStore(db dbm.DB) *EvidenceStore
func (*EvidenceStore) AddNewEvidence ¶
func (store *EvidenceStore) AddNewEvidence(evidence types.Evidence, priority int64) bool
AddNewEvidence adds the given evidence to the database. It returns false if the evidence is already stored.
func (*EvidenceStore) GetEvidenceInfo ¶
func (store *EvidenceStore) GetEvidenceInfo(height int64, hash []byte) EvidenceInfo
GetEvidenceInfo fetches the EvidenceInfo with the given height and hash. If not found, ei.Evidence is nil.
func (*EvidenceStore) MarkEvidenceAsBroadcasted ¶
func (store *EvidenceStore) MarkEvidenceAsBroadcasted(evidence types.Evidence)
MarkEvidenceAsBroadcasted removes evidence from Outqueue.
func (*EvidenceStore) MarkEvidenceAsCommitted ¶
func (store *EvidenceStore) MarkEvidenceAsCommitted(evidence types.Evidence)
MarkEvidenceAsCommitted removes evidence from pending and outqueue and sets the state to committed.
func (*EvidenceStore) PendingEvidence ¶
func (store *EvidenceStore) PendingEvidence(maxNum int64) (evidence []types.Evidence)
PendingEvidence returns up to maxNum known, uncommitted evidence. If maxNum is -1, all evidence is returned.
func (*EvidenceStore) PriorityEvidence ¶
func (store *EvidenceStore) PriorityEvidence() (evidence []types.Evidence)
PriorityEvidence returns the evidence from the outqueue, sorted by highest priority.