consensus

package module
v0.0.0-...-277f923 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2019 License: GPL-3.0 Imports: 3 Imported by: 1

README

go-consensus

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block interface {
	GetHeader() Header
}

type ChainReader

type ChainReader interface {
	GetCurrentHeader() Header
	GetHeader(hash types.Byte32, height uint64) Header
	GetHeaderByHeight(height uint64) Header
	GetHeaderByHash(hash types.Byte32) Header
	GetBlock(hash types.Byte32, height uint64) Block
}

type DataUnWrapper

type DataUnWrapper interface {
	UnWrap(oriConsensusData []byte) error
}

type DataWrapper

type DataWrapper interface {
	Wrap() ([]byte, error)
}

type Engine

type Engine interface {
	//Stuffer
	Verifier
	Forger
}

type Forger

type Forger interface {
	Forge(chain ChainReader, header Header) (Data, error)
}
type Header interface {
	GetHeight() uint64
	GetHash() types.Byte32
	GetParentHash() types.Byte32
	//GetNonce() uint64
	GetTimestamp() uint64
	GetGenerator() types.Bytes
	GetDifficulty() *big.Int
	GetOriConsensusData() types.Bytes
}

type Verifier

type Verifier interface {
	// VerifyHeader checks whether a header conforms to the consensus rules of a
	// given engine.
	VerifyHeader(chain ChainReader, header Header) error
	VerifyHeaderWithoutForge(chain ChainReader, header Header) error

	// VerifySeal checks whether the crypto seal on a header is valid according to
	// the consensus rules of the given engine.
	VerifyForge(chain ChainReader, header Header) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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