From 82246a5e949acf48c3f547da2964bd3a66d55957 Mon Sep 17 00:00:00 2001
From: Jaynti Kanani <jdkanani@gmail.com>
Date: Sat, 14 Nov 2020 14:53:23 +0530
Subject: [PATCH] chg: no verify without engine

---
 cmd/utils/bor_flags.go | 13 +++++++------
 cmd/utils/flags.go     |  9 +++++++--
 core/blockchain.go     |  2 +-
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/cmd/utils/bor_flags.go b/cmd/utils/bor_flags.go
index 3971396ab..53e2969ee 100644
--- a/cmd/utils/bor_flags.go
+++ b/cmd/utils/bor_flags.go
@@ -52,29 +52,30 @@ func getGenesis(genesisPath string) (*core.Genesis, error) {
 	return genesis, nil
 }
 
-func createBorEthereum(cfg *eth.Config) *eth.Ethereum {
+// CreateBorEthereum Creates bor ethereum object from eth.Config
+func CreateBorEthereum(cfg *eth.Config) *eth.Ethereum {
 	workspace, err := ioutil.TempDir("", "bor-command-node-")
 	if err != nil {
-		Fatalf("failed to create temporary keystore: %v", err)
+		Fatalf("Failed to create temporary keystore: %v", err)
 	}
 
 	// Create a networkless protocol stack and start an Ethereum service within
 	stack, err := node.New(&node.Config{DataDir: workspace, UseLightweightKDF: true, Name: "bor-command-node"})
 	if err != nil {
-		Fatalf("failed to create node: %v", err)
+		Fatalf("Failed to create node: %v", err)
 	}
 	ethereum, err := eth.New(stack, cfg)
 	if err != nil {
-		Fatalf("failed to register Ethereum protocol: %v", err)
+		Fatalf("Failed to register Ethereum protocol: %v", err)
 	}
 
 	// Start the node and assemble the JavaScript console around it
 	if err = stack.Start(); err != nil {
-		Fatalf("failed to start test stack: %v", err)
+		Fatalf("Failed to start stack: %v", err)
 	}
 	_, err = stack.Attach()
 	if err != nil {
-		Fatalf("failed to attach to node: %v", err)
+		Fatalf("Failed to attach to node: %v", err)
 	}
 
 	return ethereum
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index 42bd36397..39cc94f0b 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -1813,14 +1813,16 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readOnly bool) (chain *core.B
 		Fatalf("%v", err)
 	}
 	var engine consensus.Engine
+	var ethereum *eth.Ethereum
 	if config.Clique != nil {
 		engine = clique.New(config.Clique, chainDb)
 	} else if config.Bor != nil {
-		engine = createBorEthereum(&eth.Config{
+		ethereum = CreateBorEthereum(&eth.Config{
 			Genesis:         genesis,
 			HeimdallURL:     ctx.GlobalString(HeimdallURLFlag.Name),
 			WithoutHeimdall: ctx.GlobalBool(WithoutHeimdallFlag.Name),
-		}).Engine()
+		})
+		engine = ethereum.Engine()
 	} else {
 		engine = ethash.NewFaker()
 		if !ctx.GlobalBool(FakePoWFlag.Name) {
@@ -1866,6 +1868,9 @@ func MakeChain(ctx *cli.Context, stack *node.Node, readOnly bool) (chain *core.B
 	if err != nil {
 		Fatalf("Can't create BlockChain: %v", err)
 	}
+	if ethereum != nil {
+		ethereum.SetBlockchain(chain)
+	}
 	return chain, chainDb
 }
 
diff --git a/core/blockchain.go b/core/blockchain.go
index ce1edd9b7..db61ed7f5 100644
--- a/core/blockchain.go
+++ b/core/blockchain.go
@@ -320,7 +320,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, chainConfig *par
 	// The first thing the node will do is reconstruct the verification data for
 	// the head block (ethash cache or clique voting snapshot). Might as well do
 	// it in advance.
-	bc.engine.VerifyHeader(bc, bc.CurrentHeader(), true)
+	// bc.engine.VerifyHeader(bc, bc.CurrentHeader(), true)
 
 	// Check the current state of the block hashes and make sure that we do not have any of the bad blocks in our chain
 	for hash := range BadHashes {
-- 
GitLab