core

package
v0.0.0-...-91a82d4 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: LGPL-3.0 Imports: 23 Imported by: 3

README

blockchain

  1. implementation of transaction entry
  2. implementation of block entry
  3. processing block reorganization
  4. write block and states into ledger

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockChain

type BlockChain struct {
	*ledger.Ledger

	SideBlockscription feed.Subscription
	// contains filtered or unexported fields
}

BlockChain manages chain imports, reverts, chain reorganisations.

func NewBlockChain

func NewBlockChain(cfg *ledger.Config, chainCfg *params.ChainConfig, statedb state.Database, db db.Database, engine consensus.Engine, vmCfg *vm.Config) (*BlockChain, error)

NewBlockChain returns a fully initialised block chain using information available in the database.

func (*BlockChain) Config

func (bc *BlockChain) Config() *params.ChainConfig

func (*BlockChain) CurrentBlock

func (bc *BlockChain) CurrentBlock() *types.Block

CurrentBlock retrieves the current head block of the canonical chain.

func (*BlockChain) ExecActions

func (bc *BlockChain) ExecActions(statedb *state.StateDB, actions []*types.Action)

ExecActions execute actions

func (*BlockChain) ExecTransaction

func (bc *BlockChain) ExecTransaction(author *utils.Address,
	dposcontext *types.DposContext,
	gp *utils.GasPool, statedb *state.StateDB, header *types.BlockHeader,
	tx *types.Transaction, usedGas *uint64, cfg vm.Config) ([]byte, *types.Receipt, uint64, error)

ExecTransaction execute transaction and return receipts

func (*BlockChain) ExportN

func (bc *BlockChain) ExportN(w io.Writer, first uint64, last uint64) error

ExportN writes a subset of the active chain to the given writer.

func (*BlockChain) GetCurrentInfo

func (bc *BlockChain) GetCurrentInfo() (*types.Block, *state.StateDB, error)

GetCurrentInfo return current info

func (*BlockChain) InsertChain

func (bc *BlockChain) InsertChain(blocks types.Blocks) (int, error)

func (*BlockChain) PostEvent

func (bc *BlockChain) PostEvent(event interface{})

func (*BlockChain) SetAddActionInterface

func (bc *BlockChain) SetAddActionInterface(tp exec.ITxPool)

func (*BlockChain) State

func (bc *BlockChain) State() (*state.StateDB, error)

State returns a new mutable state based on the current HEAD block.

func (*BlockChain) StateAt

func (bc *BlockChain) StateAt(root utils.Hash) (*state.StateDB, error)

StateAt returns a new mutable state based on a particular point in time.

func (*BlockChain) Stop

func (bc *BlockChain) Stop()

Stop stops the blockchain service.

func (*BlockChain) SubscribeChainBlockEvent

func (bc *BlockChain) SubscribeChainBlockEvent(ch chan<- feed.BlockAndLogsEvent) feed.Subscription

SubscribeChainBlockEvent registers a subscription of Blockfeed.

func (*BlockChain) SubscribeSideBlockEvent

func (bc *BlockChain) SubscribeSideBlockEvent(ch chan<- feed.ForkBlockEvent) feed.Subscription

SubscribeSideBlockEvent registers a subscription of Blockfeed.

func (*BlockChain) WriteBlockWithState

func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts types.Receipts, state *state.StateDB) (bool, error)

WriteBlockWithState write the block to the chain and get the status.

func (*BlockChain) WriteBlockWithoutState

func (bc *BlockChain) WriteBlockWithoutState(block *types.Block, td *big.Int) error

WriteBlockWithoutState writes only the block and its metadata to the database, but does not write any state.

Directories

Path Synopsis
Package state provides a caching layer atop the Ethereum state mtp.
Package state provides a caching layer atop the Ethereum state mtp.
vm
Package vm implements the Ethereum Virtual Machine.
Package vm implements the Ethereum Virtual Machine.
runtime
Package runtime provides a basic execution model for executing EVM code.
Package runtime provides a basic execution model for executing EVM code.

Jump to

Keyboard shortcuts

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