chain

package
v1.19.14 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: BSD-3-Clause Imports: 2 Imported by: 2

Documentation

Overview

Package chain implements linear consensus protocol.

Chain handles sequential blocks in a linear topology, where each block extends exactly one parent. The consensus pipeline flows: photon → wave → focus → nova, terminating in single-threaded finality. This is the classical blockchain model: one block, one parent, one chain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// Start starts the engine
	Start(context.Context, uint32) error

	// Stop stops the engine
	Stop(context.Context) error

	// HealthCheck performs a health check
	HealthCheck(context.Context) (interface{}, error)

	// IsBootstrapped returns whether the chain is bootstrapped
	IsBootstrapped() bool
}

Engine defines the chain consensus engine

type Transitive

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

Transitive implements transitive chain consensus

func New

func New() *Transitive

New creates a new chain consensus engine

func (*Transitive) GetBlock

func (t *Transitive) GetBlock(ctx context.Context, nodeID ids.NodeID, requestID uint32, blockID ids.ID) error

GetBlock gets a block by ID

func (*Transitive) HealthCheck

func (t *Transitive) HealthCheck(ctx context.Context) (interface{}, error)

HealthCheck performs a health check

func (*Transitive) IsBootstrapped

func (t *Transitive) IsBootstrapped() bool

IsBootstrapped returns whether the chain is bootstrapped

func (*Transitive) Start

func (t *Transitive) Start(ctx context.Context, requestID uint32) error

Start starts the engine

func (*Transitive) Stop

func (t *Transitive) Stop(ctx context.Context) error

Stop stops the engine

type Transport

type Transport[ID comparable] interface {
	// Send sends a message
	Send(ctx context.Context, to string, msg interface{}) error

	// Receive receives messages
	Receive(ctx context.Context) (interface{}, error)
}

Transport handles message transport for consensus

Directories

Path Synopsis
blockmock
Package blockmock is a generated GoMock package.
Package blockmock is a generated GoMock package.
blocktest
Package blocktest provides test utilities for blocks
Package blocktest provides test utilities for blocks
Package chainmock provides mock implementations for testing
Package chainmock provides mock implementations for testing
Package chaintest provides test utilities for chains
Package chaintest provides test utilities for chains
Package syncer provides state synchronization for blockchain engines
Package syncer provides state synchronization for blockchain engines

Jump to

Keyboard shortcuts

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