diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 87770f49ab..826a45dae2 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -960,7 +960,9 @@ func (c *Bor) APIs(chain consensus.ChainHeaderReader) []rpc.API { // Close implements consensus.Engine. It's a noop for bor as there are no background threads. func (c *Bor) Close() error { c.closeOnce.Do(func() { - c.HeimdallClient.Close() + if c.HeimdallClient != nil { + c.HeimdallClient.Close() + } }) return nil diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index a3c7f49e39..091600d8b5 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -243,7 +243,11 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et genesisContractsClient := contract.NewGenesisContractsClient(chainConfig, chainConfig.Bor.ValidatorContract, chainConfig.Bor.StateReceiverContract, blockchainAPI) spanner := span.NewChainSpanner(blockchainAPI, contract.ValidatorSet(), chainConfig, common.HexToAddress(chainConfig.Bor.ValidatorContract)) - return bor.New(chainConfig, db, blockchainAPI, spanner, heimdall.NewHeimdallClient(ethConfig.HeimdallURL), genesisContractsClient) + if ethConfig.WithoutHeimdall { + return bor.New(chainConfig, db, blockchainAPI, spanner, nil, genesisContractsClient) + } else { + return bor.New(chainConfig, db, blockchainAPI, spanner, heimdall.NewHeimdallClient(ethConfig.HeimdallURL), genesisContractsClient) + } } else { switch config.PowMode { case ethash.ModeFake: