consensus

package
v0.0.0-...-4ef5390 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateChannel       = byte(0x20)
	DataChannel        = byte(0x21)
	VoteChannel        = byte(0x22)
	VoteSetBitsChannel = byte(0x23)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Reactor

type Reactor struct {
	p2p.BaseReactor // BaseService + p2p.Switch
	// contains filtered or unexported fields
}

Reactor defines a reactor for the consensus service.

func NewReactor

func NewReactor(localPeerID p2p.ID) *Reactor

NewReactor returns a new Reactor

func (*Reactor) AddPeer

func (conR *Reactor) AddPeer(peer p2p.Peer)

AddPeer implements Reactor by spawning multiple gossiping goroutines for the peer.

func (*Reactor) GetChannels

func (conR *Reactor) GetChannels() []*p2p.ChannelDescriptor

GetChannels implements Reactor

func (*Reactor) OnStart

func (conR *Reactor) OnStart() error

OnStart implements BaseService by subscribing to events, which later will be broadcasted to other peers and starting state if we're not in block sync.

func (*Reactor) OnStop

func (conR *Reactor) OnStop()

OnStop implements BaseService by unsubscribing from events and stopping state.

func (*Reactor) String

func (conR *Reactor) String() string

String returns a string representation of the Reactor. NOTE: For now, it is just a hard-coded string to avoid accessing unprotected shared variables.

func (*Reactor) SwitchToConsensus

func (conR *Reactor) SwitchToConsensus(state sm.State, skipWAL bool)

SwitchToConsensus switches from block_sync mode to consensus mode. It resets the state, turns off block_sync, and starts the consensus state-machine

Jump to

Keyboard shortcuts

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