chain

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BlackholeAddr = common.Address{
		1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
		0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	}
)

Functions

This section is empty.

Types

type Block

type Block = types.Block

type ETHChain

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

func NewDefaultChain

func NewDefaultChain(t *testing.T) (*ETHChain, chan *types.Block, chan core.NewTxPoolHeadEvent, <-chan core.NewTxsEvent)

func NewETHChain

func NewETHChain(config *eth.Config, nodecfg *node.Config, chainDB ethdb.Database, settings eth.Settings, initGenesis bool, onTxSubmitted func(*types.Transaction) error) *ETHChain

NewETHChain creates an Ethereum blockchain with the given configs.

func (*ETHChain) APIBackend

func (self *ETHChain) APIBackend() *eth.EthAPIBackend

func (*ETHChain) Accept

func (self *ETHChain) Accept(block *types.Block) error

Accept sets a minimum height at which no reorg can pass. Additionally, this function may trigger a reorg if the block being accepted is not in the canonical chain.

func (*ETHChain) AddLocalTxs

func (self *ETHChain) AddLocalTxs(txs []*types.Transaction) []error

func (*ETHChain) AddRemoteTxs

func (self *ETHChain) AddRemoteTxs(txs []*types.Transaction) []error

func (*ETHChain) AttachEthService

func (self *ETHChain) AttachEthService(handler *rpc.Server, namespaces []string)

func (*ETHChain) BlockChain

func (self *ETHChain) BlockChain() *core.BlockChain

func (*ETHChain) BlockState

func (self *ETHChain) BlockState(block *types.Block) (*state.StateDB, error)

Returns a new mutable state based on the given block.

func (*ETHChain) CurrentState

func (self *ETHChain) CurrentState() (*state.StateDB, error)

Returns a new mutable state based on the current HEAD block.

func (*ETHChain) GenBlock

func (self *ETHChain) GenBlock()

func (*ETHChain) GetBlockByHash

func (self *ETHChain) GetBlockByHash(hash common.Hash) *types.Block

Retrives a block from the database by hash.

func (*ETHChain) GetBlockByNumber

func (self *ETHChain) GetBlockByNumber(num uint64) *types.Block

Retrives a block from the database by number.

func (*ETHChain) GetGenesisBlock

func (self *ETHChain) GetGenesisBlock() *types.Block

func (*ETHChain) GetReceiptsByHash

func (self *ETHChain) GetReceiptsByHash(hash common.Hash) types.Receipts

func (*ETHChain) GetTxAcceptedSubmitCh

func (self *ETHChain) GetTxAcceptedSubmitCh() <-chan core.NewTxsEvent

func (*ETHChain) GetTxPool

func (self *ETHChain) GetTxPool() *core.TxPool

func (*ETHChain) GetTxSubmitCh

func (self *ETHChain) GetTxSubmitCh() <-chan core.NewTxsEvent

func (*ETHChain) InsertChain

func (self *ETHChain) InsertChain(chain []*types.Block) (int, error)

func (*ETHChain) LastAcceptedBlock

func (self *ETHChain) LastAcceptedBlock() *types.Block

LastAcceptedBlock returns the last block to be marked as accepted.

func (*ETHChain) PendingSize

func (self *ETHChain) PendingSize() (int, error)

func (*ETHChain) SetGasPrice

func (self *ETHChain) SetGasPrice(newGasPrice *big.Int)

SetGasPrice sets the gas price on the backend

func (*ETHChain) SetOnAPIs

func (self *ETHChain) SetOnAPIs(cb dummy.OnAPIsCallbackType)

func (*ETHChain) SetOnExtraStateChange

func (self *ETHChain) SetOnExtraStateChange(cb dummy.OnExtraStateChangeType)

func (*ETHChain) SetOnFinalize

func (self *ETHChain) SetOnFinalize(cb dummy.OnFinalizeCallbackType)

func (*ETHChain) SetOnFinalizeAndAssemble

func (self *ETHChain) SetOnFinalizeAndAssemble(cb dummy.OnFinalizeAndAssembleCallbackType)

func (*ETHChain) SetOnSeal

func (self *ETHChain) SetOnSeal(cb func(*types.Block) error)

func (*ETHChain) SetOnSealDrop

func (self *ETHChain) SetOnSealDrop(cb func(*types.Block))

func (*ETHChain) SetOnSealFinish

func (self *ETHChain) SetOnSealFinish(cb func(*types.Block) error)

func (*ETHChain) SetOnSealHash

func (self *ETHChain) SetOnSealHash(cb func(*types.Header))

func (*ETHChain) SetPreference

func (self *ETHChain) SetPreference(block *types.Block) error

SetPreference sets the current head block to the one provided as an argument regardless of what the chain contents were prior.

func (*ETHChain) Start

func (self *ETHChain) Start() error

func (*ETHChain) Stop

func (self *ETHChain) Stop()

func (*ETHChain) SubscribeNewMinedBlockEvent

func (self *ETHChain) SubscribeNewMinedBlockEvent() *event.TypeMuxSubscription

func (*ETHChain) ValidateCanonicalChain

func (self *ETHChain) ValidateCanonicalChain() error

Validate the canonical chain from current block to the genesis. This should only be called as a convenience method in tests, not in production as it traverses the entire chain.

func (*ETHChain) WriteCanonicalFromCurrentBlock

func (self *ETHChain) WriteCanonicalFromCurrentBlock(toBlock *types.Block) error

WriteCanonicalFromCurrentBlock writes the canonical chain from the current block to the genesis.

type Hash

type Hash = common.Hash

type Tx

type Tx = types.Transaction

Jump to

Keyboard shortcuts

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