pow

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: Apache-2.0, BSD-2-Clause Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const PluginName = "POW"

PluginName is the name of the PoW plugin.

Variables

View Source
var ErrMessageTooSmall = errors.New("message too small")

ErrMessageTooSmall is returned when the message is smaller than the 8-byte nonce.

View Source
var Parameters = &ParametersDefinition{}

Parameters contains the configuration used by the pow plugin.

View Source
var (
	// Plugin is the plugin instance of the PoW plugin.
	Plugin *node.Plugin
)

Functions

func DoPOW

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

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

func Worker

func Worker() *pow.Worker

Worker returns the PoW worker instance of the PoW plugin.

Types

type ParametersDefinition added in v0.7.4

type ParametersDefinition struct {
	// Difficulty defines the PoW difficulty.
	Difficulty int `default:"22" usage:"PoW difficulty"`
	// NumThreads defines how many threaded workers are used to do PoW.
	NumThreads int `default:"1" usage:"number of threads used to do the PoW"`
	// Timeout defines the maximum allow time to perform PoW.
	Timeout time.Duration `default:"1m" usage:"PoW timeout"`
	// ParentsRefreshInterval defines the timeout for parents refreshing.
	ParentsRefreshInterval time.Duration `default:"300ms" usage:"PoW parents refresh interval timeout"`
}

ParametersDefinition contains the definition of the parameters used by the pow plugin.

Jump to

Keyboard shortcuts

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