evidence

package
v0.27.3 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func RegisterEvidenceMessages added in v0.19.7

func RegisterEvidenceMessages(cdc *amino.Codec)

Types

type EvidenceInfo

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

type EvidenceListMessage

type EvidenceListMessage struct {
	Evidence []types.Evidence
}

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

func (evpool *EvidencePool) EvidenceFront() *clist.CElement

func (*EvidencePool) EvidenceWaitChan added in v0.26.0

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.

func (*EvidencePool) Update

func (evpool *EvidencePool) Update(block *types.Block, state sm.State)

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) 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.

type PeerState added in v0.26.0

type PeerState interface {
	GetHeight() int64
}

PeerState describes the state of a peer.

Jump to

Keyboard shortcuts

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