node

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 34 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAutopilot

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

func NewLogger

func NewLogger(path string) (*zap.Logger, func(context.Context) error, error)

Types

type AutopilotConfig

type AutopilotConfig struct {
	config.Autopilot
	ID string
}

type BusConfig

type BusConfig struct {
	config.Bus
	Network        *consensus.Network
	Miner          *Miner
	DBLoggerConfig stores.LoggerConfig
	DBDialector    gorm.Dialector
}

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, b worker.Bus, seed types.PrivateKey, l *zap.Logger) (http.Handler, ShutdownFn, error)

Jump to

Keyboard shortcuts

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