pow

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type POW

type POW struct {
	TxProcessor *executer.TxProcessor
	// contains filtered or unexported fields
}

func NewPOW

func NewPOW(difficulty int, txProcessor *executer.TxProcessor) *POW

NewPOW creates a new proof of work consensus.

func (*POW) GetDifficulty

func (c *POW) GetDifficulty() *big.Int

GetDifficulty returns the difficulty of the proof of work consensus.

func (*POW) GetTarget

func (c *POW) GetTarget() *big.Int

GetTarget returns the target of the proof of work consensus.

func (*POW) Mine

func (c *POW) Mine(b *types.Block, mineInterrupt chan bool) *types.Block

Mine mines the block with the proof of work consensus with the given difficulty.

func (*POW) SetDifficulty

func (c *POW) SetDifficulty(d *big.Int)

SetDifficulty sets the difficulty of the proof of work consensus.

func (*POW) Validate

func (c *POW) Validate(b *types.Block) bool

Validate validates the block with the proof of work consensus.

Jump to

Keyboard shortcuts

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