mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
done fixing build
This commit is contained in:
parent
d3c5bc9b45
commit
4de37b51a3
4 changed files with 45 additions and 41 deletions
|
|
@ -2263,7 +2263,10 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readonly bool) (*core.BlockCh
|
||||||
UseHeimdallApp: ctx.Bool(UseHeimdallAppFlag.Name),
|
UseHeimdallApp: ctx.Bool(UseHeimdallAppFlag.Name),
|
||||||
}
|
}
|
||||||
_ = CreateBorEthereum(configs)
|
_ = CreateBorEthereum(configs)
|
||||||
engine := ethconfig.CreateConsensusEngine(stack, config, configs, nil, false, chainDb, nil)
|
engine, err := ethconfig.CreateConsensusEngine(config, configs, chainDb, nil)
|
||||||
|
if err != nil {
|
||||||
|
Fatalf("%v", err)
|
||||||
|
}
|
||||||
|
|
||||||
if gcmode := ctx.String(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" {
|
if gcmode := ctx.String(GCModeFlag.Name); gcmode != "full" && gcmode != "archive" {
|
||||||
Fatalf("--%s must be either 'full' or 'archive'", GCModeFlag.Name)
|
Fatalf("--%s must be either 'full' or 'archive'", GCModeFlag.Name)
|
||||||
|
|
|
||||||
|
|
@ -155,10 +155,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
engine, err := ethconfig.CreateConsensusEngine(chainConfig, chainDb)
|
// TODO - Check this - Arpit
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
eth := &Ethereum{
|
eth := &Ethereum{
|
||||||
config: config,
|
config: config,
|
||||||
merger: consensus.NewMerger(chainDb),
|
merger: consensus.NewMerger(chainDb),
|
||||||
|
|
@ -177,12 +174,13 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
shutdownTracker: shutdowncheck.NewShutdownTracker(chainDb),
|
shutdownTracker: shutdowncheck.NewShutdownTracker(chainDb),
|
||||||
}
|
}
|
||||||
|
|
||||||
ethereum.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, ethereum, nil}
|
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil}
|
||||||
if ethereum.APIBackend.allowUnprotectedTxs {
|
// TODO - Check this - Arpit
|
||||||
log.Debug(" ###########", "Unprotected transactions allowed")
|
// if ethereum.APIBackend.allowUnprotectedTxs {
|
||||||
|
// log.Debug(" ###########", "Unprotected transactions allowed")
|
||||||
|
|
||||||
config.TxPool.AllowUnprotectedTxs = true
|
// config.TxPool.AllowUnprotectedTxs = true
|
||||||
}
|
// }
|
||||||
|
|
||||||
gpoParams := config.GPO
|
gpoParams := config.GPO
|
||||||
if gpoParams.Default == nil {
|
if gpoParams.Default == nil {
|
||||||
|
|
@ -191,18 +189,17 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
|
|
||||||
// Override the chain config with provided settings.
|
// Override the chain config with provided settings.
|
||||||
var overrides core.ChainOverrides
|
var overrides core.ChainOverrides
|
||||||
if config.OverrideShanghai != nil {
|
|
||||||
overrides.OverrideShanghai = config.OverrideShanghai
|
|
||||||
}
|
|
||||||
|
|
||||||
chainConfig, _, genesisErr := core.SetupGenesisBlockWithOverride(chainDb, trie.NewDatabase(chainDb), config.Genesis, &overrides)
|
chainConfig, _, genesisErr := core.SetupGenesisBlockWithOverride(chainDb, trie.NewDatabase(chainDb), config.Genesis, &overrides)
|
||||||
if _, isCompat := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !isCompat {
|
if _, isCompat := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !isCompat {
|
||||||
return nil, genesisErr
|
return nil, genesisErr
|
||||||
}
|
}
|
||||||
|
|
||||||
blockChainAPI := ethapi.NewBlockChainAPI(ethereum.APIBackend)
|
blockChainAPI := ethapi.NewBlockChainAPI(eth.APIBackend)
|
||||||
engine := ethconfig.CreateConsensusEngine(stack, chainConfig, config, ðashConfig, cliqueConfig, config.Miner.Notify, config.Miner.Noverify, chainDb, blockChainAPI)
|
engine, err := ethconfig.CreateConsensusEngine(chainConfig, config, chainDb, blockChainAPI)
|
||||||
ethereum.engine = engine
|
eth.engine = engine
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
// END: Bor changes
|
// END: Bor changes
|
||||||
|
|
||||||
bcVersion := rawdb.ReadDatabaseVersion(chainDb)
|
bcVersion := rawdb.ReadDatabaseVersion(chainDb)
|
||||||
|
|
@ -249,13 +246,12 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
// check if Parallel EVM is enabled
|
// check if Parallel EVM is enabled
|
||||||
// if enabled, use parallel state processor
|
// if enabled, use parallel state processor
|
||||||
if config.ParallelEVM.Enable {
|
if config.ParallelEVM.Enable {
|
||||||
ethereum.blockchain, err = core.NewParallelBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, ethereum.engine, vmConfig, ethereum.shouldPreserve, &config.TxLookupLimit, checker)
|
eth.blockchain, err = core.NewParallelBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TxLookupLimit, checker)
|
||||||
} else {
|
} else {
|
||||||
ethereum.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, ethereum.engine, vmConfig, ethereum.shouldPreserve, &config.TxLookupLimit, checker)
|
eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TxLookupLimit, checker)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override the chain config with provided settings.
|
// Override the chain config with provided settings.
|
||||||
var overrides core.ChainOverrides
|
|
||||||
if config.OverrideCancun != nil {
|
if config.OverrideCancun != nil {
|
||||||
overrides.OverrideCancun = config.OverrideCancun
|
overrides.OverrideCancun = config.OverrideCancun
|
||||||
}
|
}
|
||||||
|
|
@ -263,19 +259,19 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
overrides.OverrideVerkle = config.OverrideVerkle
|
overrides.OverrideVerkle = config.OverrideVerkle
|
||||||
}
|
}
|
||||||
|
|
||||||
ethereum.APIBackend.gpo = gasprice.NewOracle(ethereum.APIBackend, gpoParams)
|
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
_ = ethereum.engine.VerifyHeader(ethereum.blockchain, ethereum.blockchain.CurrentHeader()) // TODO think on it
|
_ = eth.engine.VerifyHeader(eth.blockchain, eth.blockchain.CurrentHeader()) // TODO think on it
|
||||||
|
|
||||||
// BOR changes
|
// BOR changes
|
||||||
ethereum.APIBackend.gpo.ProcessCache()
|
eth.APIBackend.gpo.ProcessCache()
|
||||||
// BOR changes
|
// BOR changes
|
||||||
|
|
||||||
ethereum.bloomIndexer.Start(ethereum.blockchain)
|
eth.bloomIndexer.Start(eth.blockchain)
|
||||||
|
|
||||||
if config.BlobPool.Datadir != "" {
|
if config.BlobPool.Datadir != "" {
|
||||||
config.BlobPool.Datadir = stack.ResolvePath(config.BlobPool.Datadir)
|
config.BlobPool.Datadir = stack.ResolvePath(config.BlobPool.Datadir)
|
||||||
|
|
@ -295,9 +291,9 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
cacheLimit := cacheConfig.TrieCleanLimit + cacheConfig.TrieDirtyLimit + cacheConfig.SnapshotLimit
|
cacheLimit := cacheConfig.TrieCleanLimit + cacheConfig.TrieDirtyLimit + cacheConfig.SnapshotLimit
|
||||||
if eth.handler, err = newHandler(&handlerConfig{
|
if eth.handler, err = newHandler(&handlerConfig{
|
||||||
Database: chainDb,
|
Database: chainDb,
|
||||||
Chain: ethereum.blockchain,
|
Chain: eth.blockchain,
|
||||||
TxPool: ethereum.txPool,
|
TxPool: eth.txPool,
|
||||||
Merger: ethereum.merger,
|
Merger: eth.merger,
|
||||||
Network: config.NetworkId,
|
Network: config.NetworkId,
|
||||||
Sync: config.SyncMode,
|
Sync: config.SyncMode,
|
||||||
BloomCache: uint64(cacheLimit),
|
BloomCache: uint64(cacheLimit),
|
||||||
|
|
@ -305,39 +301,39 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
RequiredBlocks: config.RequiredBlocks,
|
RequiredBlocks: config.RequiredBlocks,
|
||||||
EthAPI: blockChainAPI,
|
EthAPI: blockChainAPI,
|
||||||
checker: checker,
|
checker: checker,
|
||||||
txArrivalWait: ethereum.p2pServer.TxArrivalWait,
|
txArrivalWait: eth.p2pServer.TxArrivalWait,
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ethereum.miner = miner.New(ethereum, &config.Miner, ethereum.blockchain.Config(), ethereum.EventMux(), ethereum.engine, ethereum.isLocalBlock)
|
eth.miner = miner.New(eth, &config.Miner, eth.blockchain.Config(), eth.EventMux(), eth.engine, eth.isLocalBlock)
|
||||||
_ = ethereum.miner.SetExtra(makeExtraData(config.Miner.ExtraData))
|
_ = eth.miner.SetExtra(makeExtraData(config.Miner.ExtraData))
|
||||||
|
|
||||||
// Setup DNS discovery iterators.
|
// Setup DNS discovery iterators.
|
||||||
dnsclient := dnsdisc.NewClient(dnsdisc.Config{})
|
dnsclient := dnsdisc.NewClient(dnsdisc.Config{})
|
||||||
|
|
||||||
ethereum.ethDialCandidates, err = dnsclient.NewIterator(ethereum.config.EthDiscoveryURLs...)
|
eth.ethDialCandidates, err = dnsclient.NewIterator(eth.config.EthDiscoveryURLs...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ethereum.snapDialCandidates, err = dnsclient.NewIterator(ethereum.config.SnapDiscoveryURLs...)
|
eth.snapDialCandidates, err = dnsclient.NewIterator(eth.config.SnapDiscoveryURLs...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the RPC service
|
// Start the RPC service
|
||||||
ethereum.netRPCService = ethapi.NewNetAPI(ethereum.p2pServer, config.NetworkId)
|
eth.netRPCService = ethapi.NewNetAPI(eth.p2pServer, config.NetworkId)
|
||||||
|
|
||||||
// Register the backend on the node
|
// Register the backend on the node
|
||||||
stack.RegisterAPIs(ethereum.APIs())
|
stack.RegisterAPIs(eth.APIs())
|
||||||
stack.RegisterProtocols(ethereum.Protocols())
|
stack.RegisterProtocols(eth.Protocols())
|
||||||
stack.RegisterLifecycle(ethereum)
|
stack.RegisterLifecycle(eth)
|
||||||
|
|
||||||
// Successful startup; push a marker and check previous unclean shutdowns.
|
// Successful startup; push a marker and check previous unclean shutdowns.
|
||||||
ethereum.shutdownTracker.MarkStartup()
|
eth.shutdownTracker.MarkStartup()
|
||||||
|
|
||||||
return ethereum, nil
|
return eth, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeExtraData(extra []byte) []byte {
|
func makeExtraData(extra []byte) []byte {
|
||||||
|
|
@ -730,7 +726,8 @@ func (s *Ethereum) Stop() error {
|
||||||
|
|
||||||
// closing consensus engine first, as miner has deps on it
|
// closing consensus engine first, as miner has deps on it
|
||||||
s.engine.Close()
|
s.engine.Close()
|
||||||
s.txPool.Stop()
|
// TODO - Check this Arpit
|
||||||
|
// s.txPool.Stop()
|
||||||
s.miner.Close()
|
s.miner.Close()
|
||||||
s.blockchain.Stop()
|
s.blockchain.Stop()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,7 @@ type handlerConfig struct {
|
||||||
txArrivalWait time.Duration // Maximum duration to wait for an announced tx before requesting it
|
txArrivalWait time.Duration // Maximum duration to wait for an announced tx before requesting it
|
||||||
checker ethereum.ChainValidator
|
checker ethereum.ChainValidator
|
||||||
RequiredBlocks map[uint64]common.Hash // Hard coded map of required block hashes for sync challenges
|
RequiredBlocks map[uint64]common.Hash // Hard coded map of required block hashes for sync challenges
|
||||||
|
EthAPI *ethapi.BlockChainAPI // EthAPI to interact
|
||||||
}
|
}
|
||||||
|
|
||||||
type handler struct {
|
type handler struct {
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,10 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) {
|
||||||
if _, isCompat := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !isCompat {
|
if _, isCompat := genesisErr.(*params.ConfigCompatError); genesisErr != nil && !isCompat {
|
||||||
return nil, genesisErr
|
return nil, genesisErr
|
||||||
}
|
}
|
||||||
engine := ethconfig.CreateConsensusEngine(chainConfig, chainDb)
|
engine, err := ethconfig.CreateConsensusEngine(chainConfig, config, chainDb, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
log.Info("")
|
log.Info("")
|
||||||
log.Info(strings.Repeat("-", 153))
|
log.Info(strings.Repeat("-", 153))
|
||||||
for _, line := range strings.Split(chainConfig.Description(), "\n") {
|
for _, line := range strings.Split(chainConfig.Description(), "\n") {
|
||||||
|
|
@ -154,7 +157,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*LightEthereum, error) {
|
||||||
|
|
||||||
// Note: NewLightChain adds the trusted checkpoint so it needs an ODR with
|
// Note: NewLightChain adds the trusted checkpoint so it needs an ODR with
|
||||||
// indexers already set but not started yet
|
// indexers already set but not started yet
|
||||||
if leth.blockchain, err = light.NewLightChain(leth.odr, leth.chainConfig, leth.engine); err != nil {
|
if leth.blockchain, err = light.NewLightChain(leth.odr, leth.chainConfig, leth.engine, nil); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
leth.chainReader = leth.blockchain
|
leth.chainReader = leth.blockchain
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue