utils

package
v0.0.0-...-3154539 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const Base = 10
View Source
const PathPostfix = ".chainbridge/blockstore"

Variables

This section is empty.

Functions

func BlakeTwo256

func BlakeTwo256(dest []byte) [32]byte

func ReadCSV

func ReadCSV(filePath string) [][]string

ReadCSV - Read all items from a csv item file

func StringToBigint

func StringToBigint(src string) (*big.Int, bool)

func WriteCSV

func WriteCSV(filePath string, lines [][]string) error

WriteCSV - write the csv item file for delete/update operations

Types

type Blockstore

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

Blockstore implements Blockstorer.

func NewBlockstore

func NewBlockstore(path string, chain uint8, relayer string) (*Blockstore, error)

func (*Blockstore) StoreBlock

func (b *Blockstore) StoreBlock(block *big.Int) error

StoreBlock writes the block number to disk.

func (*Blockstore) StoreSignature

func (b *Blockstore) StoreSignature(sig string) error

StoreBlock writes the signature to disk.

func (*Blockstore) TryLoadLatestBlock

func (b *Blockstore) TryLoadLatestBlock() (*big.Int, error)

TryLoadLatestBlock will attempt to load the latest block for the chain/relayer pair, returning 0 if not found. Passing an empty string for path will cause it to use the home directory.

func (*Blockstore) TryLoadLatestSignature

func (b *Blockstore) TryLoadLatestSignature() (string, error)

TryLoadLatestBlock will attempt to load the latest block for the chain/relayer pair, returning 0 if not found. Passing an empty string for path will cause it to use the home directory.

type Blockstorer

type Blockstorer interface {
	StoreBlock(*big.Int) error
	StoreSignature(string) error
}

type EmptyStore

type EmptyStore struct{}

Dummy store for testing only

func (*EmptyStore) StoreBlock

func (s *EmptyStore) StoreBlock(_ *big.Int) error

func (*EmptyStore) StoreSignature

func (s *EmptyStore) StoreSignature(_ string) error

Jump to

Keyboard shortcuts

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