poc

package
v0.0.0-...-3f068a8 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcBlockPoc

func CalcBlockPoc(header *types.Header) *types.BlockPoc

func CalcDeadline

func CalcDeadline(scoopDataBytes []byte, genSigBytes []byte, baseTarget *big.Int) *big.Int

func CalcDifficulty

func CalcDifficulty(header *types.Header, ancestorHeaders []*types.Header) *big.Int

func CalcGenerationSignature

func CalcGenerationSignature(lastGenSigBytes []byte, lastGeneratorBytes []byte) []byte

func CalcHit

func CalcHit(scoopDataBytes []byte, genSigBytes []byte) *big.Int

func CalcScoop

func CalcScoop(genSigBytes []byte, height uint64) uint64

Types

type MineResult

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

type Poc

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

func New

func New(config *params.PocConfig) *Poc

func (*Poc) APIs

func (poc *Poc) APIs(chain consensus.ChainReader) []rpc.API

func (*Poc) Author

func (poc *Poc) Author(header *types.Header) (common.Address, error)

Author implements consensus.Engine, returning the header's coinbase as the proof-of-capacity verified author of the block.

func (*Poc) CalcDifficulty

func (poc *Poc) CalcDifficulty(chain consensus.ChainReader, time uint64, parent *types.Header) *big.Int

func (*Poc) Config

func (poc *Poc) Config() *params.PocConfig

func (*Poc) Finalize

func (poc *Poc) Finalize(chain consensus.ChainReader, header *types.Header, state *state.StateDB, txs []*types.Transaction, uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error)

Finalize implements consensus.Engine, accumulating the block and uncle rewards, setting the final state and assembling the block.

func (*Poc) GetSize

func (poc *Poc) GetSize() uint64

func (*Poc) Prepare

func (poc *Poc) Prepare(chain consensus.ChainReader, header *types.Header) error

Prepare implements consensus.Engine, initializing the difficulty field of a header to conform to the poc protocol. The changes are done inline.

func (*Poc) Seal

func (poc *Poc) Seal(chain consensus.ChainReader, block *types.Block, stop <-chan struct{}) (*types.Block, error)

func (*Poc) VerifyHeader

func (poc *Poc) VerifyHeader(chain consensus.ChainReader, header *types.Header, seal bool) error

VerifyHeader checks whether a header conforms to the consensus rules of the poc engine.

func (*Poc) VerifyHeaders

func (poc *Poc) VerifyHeaders(chain consensus.ChainReader, headers []*types.Header, seals []bool) (chan<- struct{}, <-chan error)

VerifyHeaders is similar to VerifyHeader, but verifies a batch of headers concurrently. The method returns a quit channel to abort the operations and a results channel to retrieve the async verifications.

func (*Poc) VerifySeal

func (poc *Poc) VerifySeal(chain consensus.ChainReader, header *types.Header) error

VerifySeal implements consensus.Engine, checking whether the given block satisfies the PoC difficulty requirements.

func (*Poc) VerifyUncles

func (poc *Poc) VerifyUncles(chain consensus.ChainReader, block *types.Block) error

VerifyUncles verifies that the given block's uncles conform to the consensus rules of the poc engine.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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