database

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: GPL-3.0 Imports: 35 Imported by: ? modules, 0 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

This section is empty.

Variables

View Source
var (
	DataDirPath = "database"

	// IMPORTANT: Following three values needs to correspond to the internal values used by go-ethereum
	KeystorePath = "keystore"
	ChainDbPath  = "chaindata" // it needs to match to the value passed at go-ethereum/eth/backend.go:CreateDB()
	GenesisPath  = "genesis.json"
)

Functions

func DefaultEthNodeConfig

func DefaultEthNodeConfig(dataDir string) ethNode.Config

DefaultEthNodeConfig returns the default configuration for a go-ethereum ethereum

func Init

func Init(cfg Config, ntw setup.Network, logger log.Logger) error

Types

type Config

type Config struct {
	DataDir    string
	GethConfig GethConfig
}

func NewConfig

func NewConfig(dataDir string, ctx *cli.Context) (Config, error)

type Database

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

Database handles the chain database and VM.

func NewDatabase

func NewDatabase(ctx *node.ServiceContext, ethCfg *eth.Config, consAPI consensusAPI.API) (*Database, error)

func (*Database) APIs

func (db *Database) APIs() []rpc.API

APIs returns the collection of Ethereum RPC services.

Overwrites go-ethereum/eth/backend.go::APIs().

Some of the API methods must be re-implemented to support Ethereum web3 features due to dependency on Tendermint, e.g Syncing().

func (*Database) Commit

func (db *Database) Commit(receiver common.Address) (common.Hash, error)

Commit finalises the current block

func (*Database) Config

func (db *Database) Config() *eth.Config

func (*Database) DeliverTx

DeliverTx appends a transaction to the current block

func (*Database) Ethereum

func (db *Database) Ethereum() *eth.Ethereum

func (*Database) FlushStateTrieDb

func (db *Database) FlushStateTrieDb() error

func (*Database) GasLimit

func (db *Database) GasLimit() uint64

GasLimit returns the maximum gas per block

func (*Database) InitEthState

func (db *Database) InitEthState(receiver common.Address) error

InitEthState initializes the EthState

func (*Database) Protocols

func (db *Database) Protocols() []p2p.Protocol

func (*Database) Start

func (db *Database) Start(_ *p2p.Server) error

func (*Database) Stop

func (db *Database) Stop() error

func (*Database) UpdateHeaderWithTimeInfo

func (db *Database) UpdateHeaderWithTimeInfo(tmHeader *tmtAbciTypes.Header)

UpdateHeaderWithTimeInfo uses the tendermint header to update the eth header

type EthState

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

func NewEthState

func NewEthState() *EthState

After NewEthState, call SetEthereum and SetEthConfig.

func (*EthState) Commit

func (es *EthState) Commit(receiver common.Address) (common.Hash, error)

Commit and reset the work.

func (*EthState) DeliverTx

Execute the transaction.

func (*EthState) GasLimit

func (es *EthState) GasLimit() *core.GasPool

func (*EthState) Pending

func (es *EthState) Pending() (*ethTypes.Block, *state.StateDB)

Return a new block and a copy of the ethState from the latest work. #unstable

func (*EthState) ResetWorkState

func (es *EthState) ResetWorkState(receiver common.Address) error

func (*EthState) SetEthConfig

func (es *EthState) SetEthConfig(ethConfig *eth.Config)

func (*EthState) SetEthereum

func (es *EthState) SetEthereum(ethereum *eth.Ethereum)

func (*EthState) UpdateHeaderWithTimeInfo

func (es *EthState) UpdateHeaderWithTimeInfo(
	config *params.ChainConfig, parentTime uint64, numTx uint64)

type GethConfig

type GethConfig struct {
	EthCfg   eth.Config
	NodeCfg  ethNode.Config
	Ethstats ethstatsConfig
}

type Node

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

Node is the main object.

func NewNode

func NewNode(cfg *Config, consensusAPI conAPI.API) (*Node, error)

NewNode creates a new node.

func (*Node) Database

func (n *Node) Database() *Database

func (*Node) RpcClient

func (n *Node) RpcClient() *ethRpc.Client

func (*Node) Start

func (n *Node) Start() error

Start starts base node and stop p2p server

func (*Node) Stop

func (n *Node) Stop() error

type NullBlockProcessor

type NullBlockProcessor struct{}

We need a block processor that just ignores PoW and uncles and so on.

NullBlockProcessor does not validate anything.

#unstable

func (NullBlockProcessor) ValidateBody

func (NullBlockProcessor) ValidateBody(*ethTypes.Block) error

ValidateBody does not validate anything.

#unstable

func (NullBlockProcessor) ValidateState

func (NullBlockProcessor) ValidateState(
	block,
	parent *ethTypes.Block,
	state *state.StateDB,
	receipts ethTypes.Receipts,
	usedGas uint64,
) error

ValidateState does not validate anything.

#unstable

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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