worker

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: Unlicense Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OFF uint32 = iota
	ON
)
View Source
const RoundsPerAlgo = 1

Variables

This section is empty.

Functions

func UpdateExtraNonce

func UpdateExtraNonce(msgBlock *wire.MsgBlock, blockHeight int32,
	extraNonce uint64) error

UpdateExtraNonce updates the extra nonce in the coinbase script of the passed block by regenerating the coinbase script with the passed value and block height. It also recalculates and updates the new merkle root that results from changing the coinbase script.

Types

type Counter

type Counter struct {
	C             int
	Algos         []int32
	RoundsPerAlgo int
}

func NewCounter

func NewCounter(roundsPerAlgo int) (c *Counter)

NewCounter returns an initialized algorithm rolling counter that ensures each miner does equal amounts of every algorithm

func (*Counter) GetAlgoVer

func (c *Counter) GetAlgoVer() (ver int32)

GetAlgoVer returns the next algo version based on the current configuration

type Worker

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

func New

func New(s sem.T) (w *Worker, conn net.Conn)

New initialises the state for a worker, loading the work function handler that runs a round of processing between checking quit signal and work semaphore

func NewWithConnAndSemaphore

func NewWithConnAndSemaphore(
	conn net.Conn,
	s sem.T,
	quit chan struct{},
) *Worker

NewWithConnAndSemaphore is exposed to enable use an actual network connection while retaining the same RPC API to allow a worker to be configured to run on a bare metal system with a different launcher main

func (*Worker) NewJob

func (w *Worker) NewJob(job *job.Container, reply *bool) (err error)

NewJob is a delivery of a new job for the worker, this makes the miner start mining from pause or pause, prepare the work and restart

func (*Worker) Pause

func (w *Worker) Pause(_ int, reply *bool) (err error)

Pause signals the worker to stop working, releases its semaphore and the worker is then idle

func (*Worker) SendPass

func (w *Worker) SendPass(pass string, reply *bool) (err error)

SendPass gives the encryption key configured in the kopach controller ( pod) configuration to allow workers to dispatch their solutions

func (*Worker) Stop

func (w *Worker) Stop(_ int, reply *bool) (err error)

Stop signals the worker to quit

Jump to

Keyboard shortcuts

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