|
|
|
@ -152,6 +152,10 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, err |
|
|
|
|
} |
|
|
|
|
networkID := config.NetworkId |
|
|
|
|
if networkID == 0 { |
|
|
|
|
networkID = chainConfig.ChainID.Uint64() |
|
|
|
|
} |
|
|
|
|
eth := &Ethereum{ |
|
|
|
|
config: config, |
|
|
|
|
merger: consensus.NewMerger(chainDb), |
|
|
|
@ -160,7 +164,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { |
|
|
|
|
accountManager: stack.AccountManager(), |
|
|
|
|
engine: engine, |
|
|
|
|
closeBloomHandler: make(chan struct{}), |
|
|
|
|
networkID: config.NetworkId, |
|
|
|
|
networkID: networkID, |
|
|
|
|
gasPrice: config.Miner.GasPrice, |
|
|
|
|
etherbase: config.Miner.Etherbase, |
|
|
|
|
bloomRequests: make(chan chan *bloombits.Retrieval), |
|
|
|
@ -173,7 +177,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { |
|
|
|
|
if bcVersion != nil { |
|
|
|
|
dbVer = fmt.Sprintf("%d", *bcVersion) |
|
|
|
|
} |
|
|
|
|
log.Info("Initialising Ethereum protocol", "network", config.NetworkId, "dbversion", dbVer) |
|
|
|
|
log.Info("Initialising Ethereum protocol", "network", networkID, "dbversion", dbVer) |
|
|
|
|
|
|
|
|
|
if !config.SkipBcVersionCheck { |
|
|
|
|
if bcVersion != nil && *bcVersion > core.BlockChainVersion { |
|
|
|
@ -236,7 +240,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { |
|
|
|
|
Chain: eth.blockchain, |
|
|
|
|
TxPool: eth.txPool, |
|
|
|
|
Merger: eth.merger, |
|
|
|
|
Network: config.NetworkId, |
|
|
|
|
Network: networkID, |
|
|
|
|
Sync: config.SyncMode, |
|
|
|
|
BloomCache: uint64(cacheLimit), |
|
|
|
|
EventMux: eth.eventMux, |
|
|
|
@ -270,7 +274,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Start the RPC service
|
|
|
|
|
eth.netRPCService = ethapi.NewNetAPI(eth.p2pServer, config.NetworkId) |
|
|
|
|
eth.netRPCService = ethapi.NewNetAPI(eth.p2pServer, networkID) |
|
|
|
|
|
|
|
|
|
// Register the backend on the node
|
|
|
|
|
stack.RegisterAPIs(eth.APIs()) |
|
|
|
|