Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockLevel ¶
func BlockLevel(header external.BlockHeader, maxBlockLevel int) int
BlockLevel returns the block level of the given header.
func CheckProofOfWorkByBits ¶
func CheckProofOfWorkByBits(header external.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
func NewxoShiRo256PlusPlus ¶
func NewxoShiRo256PlusPlus(hash *external.DomainHash) *xoShiRo256PlusPlus
Types ¶
type State ¶
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 ¶
func NewState(header external.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 ¶
CalculateProofOfWorkValue hashes the internal header and returns its big.Int value
func (*State) CheckProofOfWork ¶
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 ¶
func (state *State) IncrementNonce()
IncrementNonce the nonce in State by 1