node

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

TODO: remove this file when we can import it from hostd

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlockNotFound   = errors.New("block not found")
	ErrInvalidChangeID = errors.New("invalid change id")
)

Functions

func NewAutopilot

func NewAutopilot(cfg AutopilotConfig, b autopilot.Bus, workers []autopilot.Worker, l *zap.Logger) (http.Handler, RunFn, ShutdownFn, error)

func NewChainManager added in v0.7.0

func NewChainManager(cs modules.ConsensusSet, network *consensus.Network) (*chainManager, error)

NewManager creates a new chain manager.

func NewTransactionPool added in v0.7.0

func NewTransactionPool(tp modules.TransactionPool) bus.TransactionPool

Types

type AutopilotConfig

type AutopilotConfig struct {
	config.Autopilot
	ID string
}

type Bus added in v1.0.7

type Bus interface {
	worker.Bus
	s3.Bus
}

type BusConfig

type BusConfig struct {
	config.Bus
	Network             *consensus.Network
	Miner               *Miner
	DBLogger            logger.Interface
	DBDialector         gorm.Dialector
	DBMetricsDialector  gorm.Dialector
	SlabPruningInterval time.Duration
}

type Consensus

type Consensus interface {
	AcceptBlock(context.Context, types.Block) error
}

Consensus defines a minimal interface needed by the miner to interact with the consensus set

type Miner

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

A Miner is a CPU miner that can mine blocks, sending the reward to a specified address.

func NewMiner

func NewMiner(consensus Consensus) *Miner

NewMiner initializes a new CPU miner

func (*Miner) Mine

func (m *Miner) Mine(addr types.Address, n int) error

Mine mines n blocks, sending the reward to addr

func (*Miner) ProcessConsensusChange

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

ProcessConsensusChange implements modules.ConsensusSetSubscriber.

func (*Miner) ReceiveUpdatedUnconfirmedTransactions

func (m *Miner) ReceiveUpdatedUnconfirmedTransactions(diff *modules.TransactionPoolDiff)

ReceiveUpdatedUnconfirmedTransactions implements modules.TransactionPoolSubscriber

type RunFn

type RunFn = func() error

type ShutdownFn

type ShutdownFn = func(context.Context) error

func NewBus

func NewBus(cfg BusConfig, dir string, seed types.PrivateKey, l *zap.Logger) (http.Handler, ShutdownFn, error)

func NewWorker

func NewWorker(cfg config.Worker, s3Opts s3.Opts, b Bus, seed types.PrivateKey, l *zap.Logger) (http.Handler, http.Handler, ShutdownFn, error)

Jump to

Keyboard shortcuts

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