pow

package
v0.2.4-0...-2c2ceb1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2020 License: Apache-2.0, BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CfgPOWDifficulty defines the config flag of the PoW difficulty.
	CfgPOWDifficulty = "pow.difficulty"
	// CfgPOWNumThreads defines the config flag of the number of threads used to do the PoW.
	CfgPOWNumThreads = "pow.numThreads"
	// CfgPOWTimeout defines the config flag for the PoW timeout.
	CfgPOWTimeout = "pow.timeout"
)
View Source
const PluginName = "PoW"

PluginName is the name of the PoW plugin.

Variables

View Source
var (
	// ErrMessageTooSmall is returned when the message is smaller than the 8-byte nonce.
	ErrMessageTooSmall = errors.New("message too small")
)

Functions

func DoPOW

func DoPOW(msg []byte) (uint64, error)

DoPOW performs the PoW on the provided msg and returns the nonce.

func Plugin

func Plugin() *node.Plugin

Plugin gets the plugin instance.

func Tune

func Tune(d int)

Tune changes pow difficulty at runtime.

func Worker

func Worker() *pow.Worker

Worker returns the PoW worker instance of the PoW plugin.

Types

type PowDoneEvent

type PowDoneEvent struct {
	Difficulty int
	Duration   time.Duration
}

PowDoneEvent is used to pass information through a PowDone event.

type PowEvents

type PowEvents struct {
	// PowDone defines the pow done event.
	PowDone *events.Event
}

func Events

func Events() *PowEvents

Events returns the pow events.

Jump to

Keyboard shortcuts

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