mta

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashSize = 32
)

Variables

This section is empty.

Functions

func WitnessesToHashes

func WitnessesToHashes(w []Witness) [][]byte

Types

type Accumulator

type Accumulator struct {
	KeyForState []byte    // key to recover state
	Bucket      db.Bucket // bucket to store all state data
	// contains filtered or unexported fields
}

func (*Accumulator) AddData

func (a *Accumulator) AddData(d []byte) []Witness

func (*Accumulator) AddHash

func (a *Accumulator) AddHash(h []byte) []Witness

func (*Accumulator) AddNode

func (a *Accumulator) AddNode(n Node) []Witness

func (*Accumulator) Flush

func (a *Accumulator) Flush() error

func (*Accumulator) Len

func (a *Accumulator) Len() int64

func (*Accumulator) Recover

func (a *Accumulator) Recover() error

func (*Accumulator) String

func (a *Accumulator) String() string

func (*Accumulator) Verify

func (a *Accumulator) Verify(ws []Witness, h []byte) error

func (*Accumulator) WitnessFor

func (a *Accumulator) WitnessFor(idx int64) ([]Witness, error)

type Direction

type Direction int
const (
	Left Direction = iota
	Right
)

func (Direction) String

func (d Direction) String() string

type Node

type Node interface {
	Hash() []byte
	Flush() error
	WitnessFor(depth int, idx int64, w []Witness) (Node, []Witness, error)
}

type State

type State int

type Witness

type Witness struct {
	Direction Direction
	HashValue []byte
}

func HashesToWitness

func HashesToWitness(hvs [][]byte, idx int64) []Witness

func (Witness) String

func (w Witness) String() string

Jump to

Keyboard shortcuts

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