Documentation ¶
Index ¶
- func GeneratePrivateKey() (*ecdsa.PrivateKey, error)
- func MakeGenesisHeader(validators []common.Address) *types.Header
- func MakeNodeKey() *ecdsa.PrivateKey
- func PrepareExtra(header *types.Header) ([]byte, error)
- type MockBlockChain
- type MockChainReader
- func (c *MockChainReader) Config() *params.ChainConfig
- func (c *MockChainReader) CurrentHeader() *types.Header
- func (c *MockChainReader) GetHeader(hash common.Hash, blockNumber uint64) *types.Header
- func (c *MockChainReader) GetHeaderByHash(hash common.Hash) *types.Header
- func (c *MockChainReader) GetHeaderByNumber(blockNumber uint64) *types.Header
- func (c *MockChainReader) State() (*state.StateDB, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePrivateKey ¶
func GeneratePrivateKey() (*ecdsa.PrivateKey, error)
func MakeNodeKey ¶
func MakeNodeKey() *ecdsa.PrivateKey
Types ¶
type MockBlockChain ¶
type MockBlockChain struct { Statedb *state.StateDB GasLimit uint64 ChainHeadFeed *event.Feed MockCurrentBlock *types.Block }
MockBlockChain is mock struct for block chain
func (*MockBlockChain) CurrentBlock ¶
func (bc *MockBlockChain) CurrentBlock() *types.Block
type MockChainReader ¶
type MockChainReader struct { GenesisHeader *types.Header *MockBlockChain Address common.Address Trigger *bool }
MockChainReader is mock struct for chain reader, it serves basic block/ state reading for testing purposes
func GenerateMockChainReader ¶
func GenerateMockChainReader() (*MockChainReader, error)
func (*MockChainReader) Config ¶
func (c *MockChainReader) Config() *params.ChainConfig
func (*MockChainReader) CurrentHeader ¶
func (c *MockChainReader) CurrentHeader() *types.Header
func (*MockChainReader) GetHeader ¶
GetHeader implement a mock version of chainReader.GetHeader It returns correctParentHeader with Number set to input blockNumber
func (*MockChainReader) GetHeaderByHash ¶
func (c *MockChainReader) GetHeaderByHash(hash common.Hash) *types.Header
func (*MockChainReader) GetHeaderByNumber ¶
func (c *MockChainReader) GetHeaderByNumber(blockNumber uint64) *types.Header
GetHeaderByNumber implement a mock version of chainReader.GetHeaderByNumber It returns genesis Header if blockNumber is 0, else return an empty Header
Click to show internal directories.
Click to hide internal directories.