blocks

package
v0.37.23-verify-execut... Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: AGPL-3.0 Imports: 6 Imported by: 2

Documentation

Index

Constants

View Source
const BlockStoreLatestBlockMetaKey = "LatestBlockMeta"

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocks

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

Blocks facilitates access to the recent block hash values and also the latest executed block meta data

func NewBlocks

func NewBlocks(
	chainID flow.ChainID,
	rootAddress flow.Address,
	storage types.BackendStorage,
) (*Blocks, error)

NewBlocks constructs a new blocks type

func (*Blocks) BlockHash

func (b *Blocks) BlockHash(height uint64) (gethCommon.Hash, error)

BlockHash returns the block hash for the given height

func (*Blocks) LatestBlock

func (b *Blocks) LatestBlock() (*Meta, error)

func (*Blocks) PushBlockHash

func (b *Blocks) PushBlockHash(
	height uint64,
	hash gethCommon.Hash,
) error

PushBlockHash pushes a new block block hash into the storage

func (*Blocks) PushBlockMeta

func (b *Blocks) PushBlockMeta(
	meta *Meta,
) error

PushBlock pushes a new block into the storage

type Meta

type Meta struct {
	Height    uint64
	Timestamp uint64
	Random    gethCommon.Hash
}

Meta holds meta data about a block

func MetaFromEncoded

func MetaFromEncoded(data []byte) (*Meta, error)

MetaFromEncoded constructs a Meta from encoded data

func NewMeta

func NewMeta(
	height uint64,
	timestamp uint64,
	random gethCommon.Hash,
) *Meta

NewBlockMeta constructs a new block meta

func (*Meta) Encode

func (bm *Meta) Encode() []byte

Encode encodes a meta

Jump to

Keyboard shortcuts

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