censusbuilder

package
v0.0.0-...-5757dfe Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CensusBuilder

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

CensusBuilder manages multiple Census MerkleTrees

func New

func New(database db.Database, subDBsPath string) (*CensusBuilder, error)

New loads the CensusBuilder

func (*CensusBuilder) AddPublicKeys

func (cb *CensusBuilder) AddPublicKeys(censusID uint64, pubKs []babyjub.PublicKey,
	weights []*big.Int) error

AddPublicKeys adds the batch of given PublicKeys to the Census for the given censusID.

func (*CensusBuilder) AddPublicKeysAndStoreError

func (cb *CensusBuilder) AddPublicKeysAndStoreError(censusID uint64,
	pubKs []babyjub.PublicKey, weights []*big.Int)

AddPublicKeysAndStoreError will call the AddPublicKeys and if there is an error, it will store it into the DB. This method is designed to be called from a goroutine.

func (*CensusBuilder) CensusInfo

func (cb *CensusBuilder) CensusInfo(censusID uint64) (*census.Info, error)

CensusInfo returns metadata about the Census for the given CensusID

func (*CensusBuilder) CensusRoot

func (cb *CensusBuilder) CensusRoot(censusID uint64) ([]byte, error)

CensusRoot returns the Root of the Census if the Census is closed.

func (*CensusBuilder) CloseCensus

func (cb *CensusBuilder) CloseCensus(censusID uint64) error

CloseCensus closes the Census of the given censusID.

func (*CensusBuilder) GetProof

func (cb *CensusBuilder) GetProof(censusID uint64, pubK *babyjub.PublicKey) (
	uint64, []byte, error)

GetProof returns the leaf Value and the MerkleProof compressed for the given PublicKey in the given CensusID

func (*CensusBuilder) NewCensus

func (cb *CensusBuilder) NewCensus() (uint64, error)

NewCensus will create a new Census, if the Census already exists, will load it

func (*CensusBuilder) SetErrMsg

func (cb *CensusBuilder) SetErrMsg(censusID uint64, status string) error

SetErrMsg stores the given error message into the CensusID db

Jump to

Keyboard shortcuts

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