worker

package
v0.0.0-...-297edb8 Latest Latest
Warning

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

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

Documentation

Overview

Package worker implements implements mining, peer updates, and transactions 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, and starts 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 goroutine executing the runMiningOperation() to stop immediately.

func (*Worker) SignalShareTx

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

SignalShareTx signals a share transaction operation. If maxTxShareRequests signals exists 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, 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