pow

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: ISC Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockLevel added in v0.11.0

func BlockLevel(header externalapi.BlockHeader, maxBlockLevel int) int

BlockLevel returns the block level of the given header.

func CheckProofOfWorkByBits

func CheckProofOfWorkByBits(header externalapi.MutableBlockHeader) bool

CheckProofOfWorkByBits check's if the block has a valid PoW according to its Bits field it does not check if the difficulty itself is valid or less than the maximum for the appropriate network

Types

type State added in v0.11.1

type State struct {
	Timestamp int64
	Nonce     uint64
	Target    big.Int
	// contains filtered or unexported fields
}

State is an intermediate data structure with pre-computed values to speed up mining.

func NewState added in v0.11.1

func NewState(header externalapi.MutableBlockHeader) *State

NewState creates a new state with pre-computed values to speed up mining It takes the target from the Bits field

func (*State) CalculateProofOfWorkValue added in v0.11.1

func (state *State) CalculateProofOfWorkValue() *big.Int

CalculateProofOfWorkValue hashes the internal header and returns its big.Int value

func (*State) CheckProofOfWork added in v0.11.1

func (state *State) CheckProofOfWork() bool

CheckProofOfWork check's if the block has a valid PoW according to the provided target it does not check if the difficulty itself is valid or less than the maximum for the appropriate network

func (*State) IncrementNonce added in v0.11.1

func (state *State) IncrementNonce()

IncrementNonce the nonce in State by 1

Jump to

Keyboard shortcuts

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