common

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Copyright 2020 The Energi Core Authors This file is part of the Energi Core library.

The Energi Core library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Energi Core library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the Energi Core library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	// SimnetMigrationTx defines the special simnet migration tx identified set
	// as the migration file name.
	SimnetMigrationTx = "simnet-migration"
)

Variables

View Source
var ErrInvalidData = errors.New("Invalid data returned by the CacheQuery func")

ErrInvalidData is returned if the CacheQuery function returns a null result

Functions

func CreateEnergiSimnetGenesisBlock

func CreateEnergiSimnetGenesisBlock(filepath string) error

CreateEnergiSimnetGenesisBlock creates a simnet genesis block. It only creates the file if it doesn't exist in the provided file path.

func GeneralProxyHashExtractor

func GeneralProxyHashExtractor(ctx context.Context, qAddr common.Address, blockNo *uint64) *common.Hash

GeneralProxyHashExtractor retrieves if it exists the proxy hash func passed through the context.

func MastenodeEnode

func MastenodeEnode(ipv4address uint32, pubkey [2][32]byte, cfg *params.ChainConfig) *enode.Node

func SWVersionIntToString

func SWVersionIntToString(semver *big.Int) string

SWVersionIntToString returns a string from the provided software version int.

func SWVersionToInt

func SWVersionToInt() *big.Int

SWVersionToInt converts the current semantic software version to an integer.

Types

type CacheChain

type CacheChain interface {
	CurrentBlock() *eth_types.Block
	IsPublicService() bool
}

CacheChain defines the method(s) needed by the cache implementation to access the chain data.

type CacheQuery

type CacheQuery func(block_num *big.Int) (interface{}, error)

CacheQuery is the function that allow a fresh data query if the previous data held is considered to have expired or the cache was empty in the first place.

type CacheStorage

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

CacheStorage is a storage that is held by the client that wants to cache specific data.

func NewCacheStorage

func NewCacheStorage() *CacheStorage

NewCacheStorage creates a new CacheStorage instance.

func (*CacheStorage) Get

func (c *CacheStorage) Get(chain CacheChain, source CacheQuery) (interface{}, error)

Get returns the cached data The existing data is updated on private calls when the new blockhash is generated othetwise (for publicservice calls) it returns existing data and asynchronously schedules the update An error is returned if a nil cache instance is used or the cache query function returns nil data.

type GeneralProxyHashFunc

type GeneralProxyHashFunc func(addr common.Address, blockheight *uint64) *common.Hash

GeneralProxyHashFunc provides the function that helps check for governed proxy contracts filtered logs.

func GeneralProxyHashGen

func GeneralProxyHashGen(blockchain *core.BlockChain) GeneralProxyHashFunc

GeneralProxyHashGen returns a function that helps retrieve the governed proxy contract hash.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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