worker

package
v0.0.0-...-ce930bf Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package worker implements mining, peer updates, and transaction sharing for the blockchain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(st *state.State, evHandler state.EventHandler)

Run creates a worker, registers the worker with the state package, and starts up all the background processes.

Types

type Worker

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

Worker manages the POW workflows for the blockchain.

func (*Worker) Shutdown

func (w *Worker) Shutdown()

Shutdown terminates the goroutine performing work.

func (*Worker) SignalCancelMining

func (w *Worker) SignalCancelMining()

SignalCancelMining signals the G executing the runMiningOperation function to stop immediately.

func (*Worker) SignalShareTx

func (w *Worker) SignalShareTx(blockTx database.BlockTx)

SignalShareTx signals a share transaction operation. If maxTxShareRequests signals exist in the channel, we won't send these.

func (*Worker) SignalStartMining

func (w *Worker) SignalStartMining()

SignalStartMining starts a mining operation. If there is already a signal pending in the channel, just return since a mining operation will start.

func (*Worker) Sync

func (w *Worker) Sync()

Sync updates the peer list, mempool and blocks.

Jump to

Keyboard shortcuts

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