consensus

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: ISC Imports: 11 Imported by: 3

Documentation

Overview

Package consensus implements the czz consensus engine.

Index

Constants

View Source
const CZZDataSize = 8
View Source
const TBLSize = 33554432

Variables

This section is empty.

Functions

func BigToCompact

func BigToCompact(n *big.Int) uint32

func CZZhashFull

func CZZhashFull(hash []byte, nonce uint64) []byte

CZZhashFull aggregates data from the full dataset (using the full in-memory dataset) in order to produce our final value for a particular header hash and nonce.

func CompactToBig

func CompactToBig(compact uint32) *big.Int

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until UseLogger is called.

func DoubleHashB

func DoubleHashB(b []byte) []byte

DoubleHashB calculates hash(hash(b)) and returns the resulting bytes.

func DoubleHashH

func DoubleHashH(b []byte) chainhash.Hash

func HashB

func HashB(b []byte) []byte

HashB calculates hash(b) and returns the resulting bytes.

func HashCZZ

func HashCZZ(header []byte, nonce uint64) []byte

func HashH

func HashH(b []byte) chainhash.Hash

HashH calculates hash(b) and returns the resulting bytes as a Hash.

func MineBlock

func MineBlock(conf *MiningParam) (uint64, bool)

func UseLogger

func UseLogger(logger czzlog.Logger)

UseLogger uses a specified Logger to output package logging info.

func VerifyBlockSeal

func VerifyBlockSeal(Info *CzzConsensusParam, nonce uint64) error

Types

type CZZTBL

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

type CzzConsensusParam

type CzzConsensusParam struct {
	HeadHash chainhash.Hash
	Target   *big.Int
}

type MiningParam

type MiningParam struct {
	Info    *CzzConsensusParam
	MinerID int
	Begin   uint64
	Loops   uint64
	Done    uint64
	Abort   chan struct{}
}

Jump to

Keyboard shortcuts

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