witness

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusPublished = iota
	StatusReceived
	StatusFinished
)
View Source
const (
	TableNamePrefix = `witness`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchWitness

type BatchWitness struct {
	gorm.Model
	Height      int64 `gorm:"index:idx_height,unique"`
	WitnessData string
	Status      int64 `gorm:"index"`
}

type Witness

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

func NewWitness

func NewWitness(accountTree bsmt.SparseMerkleTree, totalOpsNumber uint32,
	ops []utils.AccountInfo, cexAssets []utils.CexAssetInfo,
	config *config.Config) *Witness

func (*Witness) ComputeAccountHash

func (w *Witness) ComputeAccountHash(accountIndex uint32, highAccountIndex uint32, currentIndex uint32)

func (*Witness) ExecuteBatchCreateUser

func (w *Witness) ExecuteBatchCreateUser(accountIndex uint32, currentNumber uint32, batchCreateUserWit *utils.BatchCreateUserWitness)

func (*Witness) GetCexAssets

func (w *Witness) GetCexAssets(wit *BatchWitness) []utils.CexAssetInfo

func (*Witness) Run

func (w *Witness) Run()

func (*Witness) WriteBatchWitnessToDB

func (w *Witness) WriteBatchWitnessToDB()

type WitnessModel

type WitnessModel interface {
	CreateBatchWitnessTable() error
	DropBatchWitnessTable() error
	GetLatestBatchWitnessHeight() (height int64, err error)
	GetBatchWitnessByHeight(height int64) (witness *BatchWitness, err error)
	UpdateBatchWitnessStatus(witness *BatchWitness, status int64) error
	GetLatestBatchWitness() (witness *BatchWitness, err error)
	GetLatestBatchWitnessByStatus(status int64) (witness *BatchWitness, err error)
	CreateBatchWitness(witness []BatchWitness) error
	GetRowCounts() (count []int64, err error)
}

func NewWitnessModel

func NewWitnessModel(db *gorm.DB, suffix string) WitnessModel

Jump to

Keyboard shortcuts

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