pow

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: Apache-2.0, BSD-2-Clause Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const PluginName = "POW"

PluginName is the name of the PoW plugin.

Variables

View Source
var ErrBlockTooSmall = errors.New("block too small")

ErrBlockTooSmall is returned when the block 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(blk []byte) (uint64, error)

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

func Worker

func Worker() *pow.Worker

Worker returns the PoW worker instance of the PoW plugin.

Types

type ParametersDefinition

type ParametersDefinition struct {
	// Difficulty defines the PoW difficulty.
	Difficulty int `default:"0" 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