Documentation ¶
Index ¶
- Constants
- func RegisterEvidenceMessages(cdc *amino.Codec)
- 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) MarkEvidenceAsCommitted(height int64, evidence []types.Evidence)
- func (evpool *EvidencePool) PendingEvidence(maxBytes 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) GetEvidence(height int64, hash []byte) *EvidenceInfo
- func (store *EvidenceStore) MarkEvidenceAsBroadcasted(evidence types.Evidence)
- func (store *EvidenceStore) MarkEvidenceAsCommitted(evidence types.Evidence)
- func (store *EvidenceStore) PendingEvidence(maxBytes int64) (evidence []types.Evidence)
- func (store *EvidenceStore) PriorityEvidence() (evidence []types.Evidence)
- type PeerState
Constants ¶
const (
EvidenceChannel = byte(0x38)
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EvidenceInfo ¶
type EvidenceListMessage ¶
EvidenceMessage contains a list of evidence.
func (*EvidenceListMessage) String ¶
func (m *EvidenceListMessage) String() string
String returns a string representation of the EvidenceListMessage.
type EvidenceMessage ¶
type EvidenceMessage interface{}
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 dbm.DB, evidenceStore *EvidenceStore) *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 ¶
func (evpool *EvidencePool) EvidenceFront() *clist.CElement
func (*EvidencePool) EvidenceWaitChan ¶
func (evpool *EvidencePool) EvidenceWaitChan() <-chan struct{}
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(maxBytes int64) []types.Evidence
PendingEvidence returns uncommitted evidence up to maxBytes. If maxBytes 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) GetEvidence ¶
func (store *EvidenceStore) GetEvidence(height int64, hash []byte) *EvidenceInfo
GetEvidence fetches the evidence with the given height and hash.
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(maxBytes int64) (evidence []types.Evidence)
PendingEvidence returns known uncommitted evidence up to maxBytes. If maxBytes 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.