opinionhash

package
v1.7.0-alpha.1-nomain Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PutHasher added in v1.6.0

func PutHasher(hasher *OpinionHasher)

PutHasher resets the hasher and puts it back to the pool.

Types

type OpinionHasher

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

OpinionHasher is a utility for computing opinion hash.

func GetHasher added in v1.6.0

func GetHasher() *OpinionHasher

GetHasher will get an OpinionHasher from the pool. It may or may not allocate a new one. Consumers are not required to call Reset() on the hasher before putting it back in the pool.

func New

func New() *OpinionHasher

New returns new instance of the opinion hasher.

func (*OpinionHasher) Hash

func (h *OpinionHasher) Hash() (rst types.Hash32)

Hash instantiates 32bytes and write hash.Sum to it.

func (*OpinionHasher) Reset

func (h *OpinionHasher) Reset()

Reset opinion hasher state.

func (*OpinionHasher) Sum

func (h *OpinionHasher) Sum(dst []byte) []byte

Sum appends hash sum to dst.

func (*OpinionHasher) WriteAbstain

func (h *OpinionHasher) WriteAbstain()

WriteAbstain writes abstain sentinel as an opinion.

func (*OpinionHasher) WritePrevious

func (h *OpinionHasher) WritePrevious(hash types.Hash32)

WritePrevious aggregated hash.

func (*OpinionHasher) WriteSupport

func (h *OpinionHasher) WriteSupport(id types.BlockID, height uint64)

WriteSupport writes id and height of the block.

Jump to

Keyboard shortcuts

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