block

package
v0.0.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	StatusProposing
	StatusPending
	StatusCommitted
	StatusVerifiedAndExecuted
)
View Source
const (
	BlockTableName = `block`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	gorm.Model
	BlockSize uint16
	// pubdata
	BlockCommitment                 string
	BlockHeight                     int64 `gorm:"uniqueIndex"`
	StateRoot                       string
	PriorityOperations              int64
	PendingOnChainOperationsHash    string
	PendingOnChainOperationsPubData string
	CommittedTxHash                 string
	CommittedAt                     int64
	VerifiedTxHash                  string
	VerifiedAt                      int64
	Txs                             []*tx.Tx `gorm:"foreignKey:BlockId"`
	BlockStatus                     int64
}

func (*Block) ClearTxsModel

func (b *Block) ClearTxsModel()

func (*Block) TableName

func (*Block) TableName() string

type BlockModel

type BlockModel interface {
	CreateBlockTable() error
	DropBlockTable() error
	GetBlocks(limit int64, offset int64) (blocks []*Block, err error)
	GetBlocksBetween(start int64, end int64) (blocks []*Block, err error)
	GetBlockByHeight(blockHeight int64) (block *Block, err error)
	GetBlockByHeightWithoutTx(blockHeight int64) (block *Block, err error)
	GetCommittedBlocksCount() (count int64, err error)
	GetVerifiedBlocksCount() (count int64, err error)
	GetLatestVerifiedHeight() (height int64, err error)
	GetBlockByCommitment(blockCommitment string) (block *Block, err error)
	GetCommittedBlocksBetween(start, end int64) (blocks []*Block, err error)
	GetBlocksTotalCount() (count int64, err error)
	CreateGenesisBlock(block *Block) error
	GetCurrentBlockHeight() (blockHeight int64, err error)
	CreateBlockInTransact(tx *gorm.DB, oBlock *Block) error
	UpdateBlocksWithoutTxsInTransact(tx *gorm.DB, blocks []*Block) (err error)
	UpdateBlockInTransact(tx *gorm.DB, block *Block) (err error)
}

func NewBlockModel

func NewBlockModel(db *gorm.DB) BlockModel

type BlockStates

type BlockStates struct {
	Block           *Block
	CompressedBlock *compressedblock.CompressedBlock

	PendingAccount        []*account.Account
	PendingAccountHistory []*account.AccountHistory
	PendingNft            []*nft.L2Nft
	PendingNftHistory     []*nft.L2NftHistory
}

Jump to

Keyboard shortcuts

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