pow

package
v0.5.1-rc3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler handles PoW requests of the node and tunnels them to powsrv.io or uses local PoW if no API key was specified or the connection failed.

func New

func New(log *logger.Logger, powsrvAPIKey string, powsrvInitCooldown time.Duration) *Handler

New creates a new PoW handler instance.

func (*Handler) Close

func (h *Handler) Close()

Close closes the PoW handler

func (*Handler) DoPoW

func (h *Handler) DoPoW(trytes trinary.Trytes, mwm int, parallelism ...int) (nonce string, err error)

DoPoW calculates the PoW Either with the fastest available local PoW function or with the help of powsrv.io (optional, POWSRV_API_KEY env var must be available)

func (*Handler) GetPoWType

func (h *Handler) GetPoWType() string

GetPoWType returns the fastest available PoW type which gets used for PoW requests

Jump to

Keyboard shortcuts

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