blockstore

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: GPL-3.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("key not found")
)

Functions

func GetLastStoredBlock

func GetLastStoredBlock(db KeyValueReader, chainID uint64) (*big.Int, error)

func SetupBlockstore

func SetupBlockstore(generalConfig *config.GeneralChainConfig, kvdb KeyValueReaderWriter, startBlock *big.Int) (*big.Int, error)

SetupBlockstore queries the blockstore for the latest known block. If the latest block is greater than config.StartBlock, then config.StartBlock is replaced with the latest known block.

func StoreBlock

func StoreBlock(db KeyValueWriter, block *big.Int, chainID uint64) error

Types

type KeyValueReader

type KeyValueReader interface {
	GetByKey(key []byte) ([]byte, error)
}

type KeyValueReaderWriter

type KeyValueReaderWriter interface {
	KeyValueReader
	KeyValueWriter
}

type KeyValueWriter

type KeyValueWriter interface {
	SetByKey(key []byte, value []byte) error
}

Jump to

Keyboard shortcuts

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