mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-25 13:07:17 +00:00
75ca6b8c76
* Initial work on integration tests * Delete subtree * Squashed 'interfaces/' content from commit 41a082ba4 git-subtree-dir: interfaces git-subtree-split: 41a082ba4bde38647325eb0416cb1da1b4ca2b12 * Add consensus interfaces * More stuff * comments * Fix compile * Squashed 'interfaces/' changes from 41a082ba4..1b13a42a7 1b13a42a7 Add chainspec to consensus interface git-subtree-dir: interfaces git-subtree-split: 1b13a42a7803f5464722867a71065c27a7ebe8c3 * Squashed 'interfaces/' changes from 1b13a42a7..93a072c4c 93a072c4c Add missing import git-subtree-dir: interfaces git-subtree-split: 93a072c4c099d169322a3a53b95e40203276820b * New consensus interfaces * More on clique * Fix tests * Squashed 'interfaces/' changes from 93a072c4c..62f4ec4b2 62f4ec4b2 Add test service for consensus engine git-subtree-dir: interfaces git-subtree-split: 62f4ec4b263107635ffa3aabd5d634af22e813c6 * Squashed 'interfaces/' changes from 62f4ec4b2..061a63543 061a63543 Fix git-subtree-dir: interfaces git-subtree-split: 061a63543babdeb51ab7e3a96dec56b2485d4389 * Configuring clique engine with toml specs - start * More toml parsing * Constructed rinkeby genesis * Simplify VerifyHeaders functions * Fix lint * Remove concurrent verification tests * Fix lint Co-authored-by: Alex Sharp <alexsharp@Alexs-MacBook-Pro.local> Co-authored-by: Alexey Sharp <alexeysharp@Alexeys-iMac.local>
81 lines
2.6 KiB
Go
81 lines
2.6 KiB
Go
package adapter
|
|
|
|
import (
|
|
"math/big"
|
|
|
|
"github.com/ledgerwatch/turbo-geth/common"
|
|
"github.com/ledgerwatch/turbo-geth/consensus"
|
|
"github.com/ledgerwatch/turbo-geth/core/rawdb"
|
|
"github.com/ledgerwatch/turbo-geth/core/state"
|
|
"github.com/ledgerwatch/turbo-geth/core/types"
|
|
"github.com/ledgerwatch/turbo-geth/ethdb"
|
|
"github.com/ledgerwatch/turbo-geth/params"
|
|
"github.com/ledgerwatch/turbo-geth/rpc"
|
|
)
|
|
|
|
type chainContext struct {
|
|
tx ethdb.Tx
|
|
}
|
|
|
|
func NewChainContext(tx ethdb.Tx) *chainContext {
|
|
return &chainContext{
|
|
tx: tx,
|
|
}
|
|
}
|
|
|
|
type powEngine struct {
|
|
}
|
|
|
|
func (c *powEngine) VerifyHeader(chain consensus.ChainHeaderReader, header *types.Header, seal bool) error {
|
|
|
|
panic("must not be called")
|
|
}
|
|
func (c *powEngine) VerifyHeaders(chain consensus.ChainHeaderReader, headers []*types.Header, seals []bool) error {
|
|
panic("must not be called")
|
|
}
|
|
func (c *powEngine) VerifyUncles(chain consensus.ChainReader, block *types.Block) error {
|
|
panic("must not be called")
|
|
}
|
|
func (c *powEngine) VerifySeal(chain consensus.ChainHeaderReader, header *types.Header) error {
|
|
panic("must not be called")
|
|
}
|
|
func (c *powEngine) Prepare(chain consensus.ChainHeaderReader, header *types.Header) error {
|
|
panic("must not be called")
|
|
}
|
|
func (c *powEngine) Finalize(chainConfig *params.ChainConfig, header *types.Header, state *state.IntraBlockState, txs []types.Transaction, uncles []*types.Header) {
|
|
panic("must not be called")
|
|
}
|
|
func (c *powEngine) FinalizeAndAssemble(chainConfig *params.ChainConfig, header *types.Header, state *state.IntraBlockState, txs []types.Transaction,
|
|
uncles []*types.Header, receipts []*types.Receipt) (*types.Block, error) {
|
|
panic("must not be called")
|
|
}
|
|
|
|
func (c *powEngine) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
|
panic("must not be called")
|
|
}
|
|
func (c *powEngine) SealHash(header *types.Header) common.Hash {
|
|
panic("must not be called")
|
|
}
|
|
func (c *powEngine) CalcDifficulty(chain consensus.ChainHeaderReader, time, parentTime uint64, parentDifficulty *big.Int, parentNumber uint64, parentHash, parentUncleHash common.Hash) *big.Int {
|
|
panic("must not be called")
|
|
}
|
|
func (c *powEngine) APIs(chain consensus.ChainHeaderReader) []rpc.API {
|
|
panic("must not be called")
|
|
}
|
|
|
|
func (c *powEngine) Close() error {
|
|
panic("must not be called")
|
|
}
|
|
|
|
func (c *powEngine) Author(header *types.Header) (common.Address, error) {
|
|
return header.Coinbase, nil
|
|
}
|
|
|
|
func (c *chainContext) GetHeader(hash common.Hash, number uint64) *types.Header {
|
|
return rawdb.ReadHeader(ethdb.NewRoTxDb(c.tx), hash, number)
|
|
}
|
|
|
|
func (c *chainContext) Engine() consensus.Engine {
|
|
return &powEngine{}
|
|
}
|