pow

package
v2.0.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Apache-2.0 Imports: 9 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 uses local PoW. It refreshes the tips of blocks during PoW.

func New

func New(targetScore uint32, refreshTipsInterval time.Duration) *Handler

New creates a new PoW handler instance.

func (*Handler) DoPoW

func (h *Handler) DoPoW(ctx context.Context, block *iotago.Block, parallelism int, refreshTipsFunc ...RefreshTipsFunc) (blockSize int, err error)

DoPoW does the proof-of-work required to hit the target score configured on this Handler. The given iota.Block's nonce is automatically updated.

func (*Handler) PoWType

func (h *Handler) PoWType() string

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

type RefreshTipsFunc

type RefreshTipsFunc = func() (tips iotago.BlockIDs, err error)

RefreshTipsFunc refreshes tips of the block if PoW takes longer than a configured duration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳