evidence

package
v0.18.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvidenceChannel = byte(0x38)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EvidenceInfo

type EvidenceInfo struct {
	Committed bool
	Priority  int64
	Evidence  types.Evidence
}

type EvidenceListMessage

type EvidenceListMessage struct {
	Evidence []types.Evidence
}

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.

func DecodeMessage added in v0.15.0

func DecodeMessage(bz []byte) (msgType byte, msg EvidenceMessage, err error)

DecodeMessage decodes a byte-array into a EvidenceMessage.

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. Blocks on the EvidenceChan.

func (*EvidencePool) EvidenceChan added in v0.15.0

func (evpool *EvidencePool) EvidenceChan() <-chan types.Evidence

EvidenceChan returns an unbuffered channel on which new evidence can be received.

func (*EvidencePool) MarkEvidenceAsCommitted

func (evpool *EvidencePool) MarkEvidenceAsCommitted(evidence []types.Evidence)

MarkEvidenceAsCommitted marks all the evidence as committed.

func (*EvidencePool) PendingEvidence

func (evpool *EvidencePool) PendingEvidence() []types.Evidence

PendingEvidence returns all uncommitted evidence.

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.

func (*EvidencePool) Update

func (evpool *EvidencePool) Update(block *types.Block)

Update loads the latest

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) OnStart added in v0.15.0

func (evR *EvidenceReactor) OnStart() error

OnStart implements cmn.Service

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 added in v0.15.0

func (store *EvidenceStore) GetEvidence(height int64, hash []byte) *EvidenceInfo

GetEvidence fetches the evidence with the given height and hash.

func (*EvidenceStore) ListEvidence added in v0.15.0

func (store *EvidenceStore) ListEvidence(prefixKey string) (evidence []types.Evidence)

ListEvidence lists the evidence for the given prefix key. It is wrapped by PriorityEvidence and PendingEvidence for convenience.

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)

MarkEvidenceAsPending removes evidence from pending and outqueue and sets the state to committed.

func (*EvidenceStore) PendingEvidence

func (store *EvidenceStore) PendingEvidence() (evidence []types.Evidence)

PendingEvidence returns all known uncommitted evidence.

func (*EvidenceStore) PriorityEvidence

func (store *EvidenceStore) PriorityEvidence() (evidence []types.Evidence)

PriorityEvidence returns the evidence from the outqueue, sorted by highest priority.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL