block

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_block_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type Block

type Block struct {
	Hash             []byte   `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	BlockNumber      uint64   `protobuf:"varint,2,opt,name=blockNumber,proto3" json:"blockNumber,omitempty"`
	ParentBlockHash  []byte   `protobuf:"bytes,3,opt,name=parentBlockHash,proto3" json:"parentBlockHash,omitempty"`
	Status           string   `protobuf:"bytes,4,opt,name=status,proto3" json:"status,omitempty"`
	SequencerAddress []byte   `protobuf:"bytes,5,opt,name=sequencerAddress,proto3" json:"sequencerAddress,omitempty"`
	GlobalStateRoot  []byte   `protobuf:"bytes,6,opt,name=globalStateRoot,proto3" json:"globalStateRoot,omitempty"`
	OldRoot          []byte   `protobuf:"bytes,7,opt,name=oldRoot,proto3" json:"oldRoot,omitempty"`
	AcceptedTime     int64    `protobuf:"varint,8,opt,name=acceptedTime,proto3" json:"acceptedTime,omitempty"`
	TimeStamp        int64    `protobuf:"varint,9,opt,name=timeStamp,proto3" json:"timeStamp,omitempty"`
	TxCount          uint64   `protobuf:"varint,10,opt,name=txCount,proto3" json:"txCount,omitempty"`
	TxCommitment     []byte   `protobuf:"bytes,11,opt,name=txCommitment,proto3" json:"txCommitment,omitempty"`
	EventCount       uint64   `protobuf:"varint,12,opt,name=eventCount,proto3" json:"eventCount,omitempty"`
	EventCommitment  []byte   `protobuf:"bytes,13,opt,name=eventCommitment,proto3" json:"eventCommitment,omitempty"`
	TxHashes         [][]byte `protobuf:"bytes,14,rep,name=TxHashes,proto3" json:"TxHashes,omitempty"`
	// contains filtered or unexported fields
}

func (*Block) Descriptor deprecated

func (*Block) Descriptor() ([]byte, []int)

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetAcceptedTime

func (x *Block) GetAcceptedTime() int64

func (*Block) GetBlockNumber

func (x *Block) GetBlockNumber() uint64

func (*Block) GetEventCommitment

func (x *Block) GetEventCommitment() []byte

func (*Block) GetEventCount

func (x *Block) GetEventCount() uint64

func (*Block) GetGlobalStateRoot

func (x *Block) GetGlobalStateRoot() []byte

func (*Block) GetHash

func (x *Block) GetHash() []byte

func (*Block) GetOldRoot

func (x *Block) GetOldRoot() []byte

func (*Block) GetParentBlockHash

func (x *Block) GetParentBlockHash() []byte

func (*Block) GetSequencerAddress

func (x *Block) GetSequencerAddress() []byte

func (*Block) GetStatus

func (x *Block) GetStatus() string

func (*Block) GetTimeStamp

func (x *Block) GetTimeStamp() int64

func (*Block) GetTxCommitment

func (x *Block) GetTxCommitment() []byte

func (*Block) GetTxCount

func (x *Block) GetTxCount() uint64

func (*Block) GetTxHashes

func (x *Block) GetTxHashes() [][]byte

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

type Manager

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

Manager is a Block database manager to save and search the blocks.

func NewManager

func NewManager(database db.Database) *Manager

NewManager returns a new Block manager using the given database.

func (*Manager) Close

func (manager *Manager) Close()

func (*Manager) GetBlockByHash

func (manager *Manager) GetBlockByHash(blockHash *felt.Felt) (*types.Block, error)

GetBlockByHash search the block with the given block hash. If the block does not exist then returns nil. If any error happens, then panic.

func (*Manager) GetBlockByNumber

func (manager *Manager) GetBlockByNumber(blockNumber uint64) (*types.Block, error)

GetBlockByNumber search the block with the given block number. If the block does not exist then returns nil. If any error happens, then panic.

func (*Manager) PutBlock

func (manager *Manager) PutBlock(blockHash *felt.Felt, block *types.Block) error

PutBlock saves the given block with the given hash as key. If any error happens then panic.

Jump to

Keyboard shortcuts

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