blocks

package
v0.37.24-programs-cach... Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: AGPL-3.0 Imports: 6 Imported by: 2 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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