chain

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBlockNotFound is returned when a block is not found.
	ErrBlockNotFound = errors.New("block not found")
)

Functions

This section is empty.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

A Manager manages the current state of the blockchain.

func NewManager

func NewManager(cs modules.ConsensusSet) (*Manager, error)

NewManager creates a new chain manager.

func (*Manager) AcceptBlock

func (m *Manager) AcceptBlock(b types.Block) error

AcceptBlock adds b to the consensus set.

func (*Manager) BlockAtHeight

func (m *Manager) BlockAtHeight(height uint64) (types.Block, bool)

BlockAtHeight returns the block at the given height.

func (*Manager) Close

func (m *Manager) Close() error

Close closes the chain manager.

func (*Manager) IndexAtHeight

func (m *Manager) IndexAtHeight(height uint64) (types.ChainIndex, error)

IndexAtHeight return the chain index at the given height.

func (*Manager) Network

func (m *Manager) Network() string

Network returns the network name.

func (*Manager) ProcessConsensusChange

func (m *Manager) ProcessConsensusChange(cc modules.ConsensusChange)

ProcessConsensusChange implements the modules.ConsensusSetSubscriber interface.

func (*Manager) Subscribe

func (m *Manager) Subscribe(s modules.ConsensusSetSubscriber, ccID modules.ConsensusChangeID, cancel <-chan struct{}) error

Subscribe subscribes to the consensus set.

func (*Manager) Synced

func (m *Manager) Synced() bool

Synced returns true if the chain manager is synced with the consensus set.

func (*Manager) TipState

func (m *Manager) TipState() consensus.State

TipState returns the current chain state.

Jump to

Keyboard shortcuts

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