chain

package
v0.8.3-rc.3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 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 core.NewTxPoolHeadEvent, <-chan core.NewTxsEvent)

func NewETHChain

func NewETHChain(config *eth.Config, nodecfg *node.Config, chainDB ethdb.Database, settings eth.Settings, consensusCallbacks *dummy.ConsensusCallbacks, lastAcceptedHash common.Hash, clock *mockable.Clock) (*ETHChain, error)

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) AddRemoteTxsSync added in v0.7.1

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

func (*ETHChain) AttachEthService

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

AttachEthService registers the backend RPC services provided by Ethereum to the provided handler under their assigned namespaces.

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) CurrentBlock added in v0.6.0

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

func (*ETHChain) CurrentState

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

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

func (*ETHChain) GenerateBlock added in v0.5.2

func (self *ETHChain) GenerateBlock() (*types.Block, error)

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) InsertBlock added in v0.5.4

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

func (*ETHChain) LastAcceptedBlock

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

LastAcceptedBlock returns the last block to be marked as accepted.

func (*ETHChain) NewRPCHandler

func (self *ETHChain) NewRPCHandler(maximumDuration time.Duration) *rpc.Server

func (*ETHChain) PendingSize

func (self *ETHChain) PendingSize() int

func (*ETHChain) Reject added in v0.5.4

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

Reject tells the chain that [block] has been rejected.

func (*ETHChain) RemoveRejectedBlocks added in v0.5.4

func (self *ETHChain) RemoveRejectedBlocks(start, end uint64) error

RemoveRejectedBlocks removes the rejected blocks between heights [start] and [end].

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()

func (*ETHChain) Stop

func (self *ETHChain) Stop()

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.

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