[node] Exit program if either shardchain or beaconchain is nil (#2030)

pull/2032/head
Edgar Aroutiounian 5 years ago committed by GitHub
parent e7cd387677
commit f84ebfa7f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      node/node.go

@ -3,6 +3,7 @@ package node
import ( import (
"crypto/ecdsa" "crypto/ecdsa"
"fmt" "fmt"
"os"
"sync" "sync"
"time" "time"
@ -435,6 +436,12 @@ func New(host p2p.Host, consensusObj *consensus.Consensus,
// Load the chains. // Load the chains.
blockchain := node.Blockchain() // this also sets node.isFirstTime if the DB is fresh blockchain := node.Blockchain() // this also sets node.isFirstTime if the DB is fresh
beaconChain := node.Beaconchain() beaconChain := node.Beaconchain()
if b1, b2 := beaconChain == nil, blockchain == nil; b1 || b2 {
fmt.Fprintf(
os.Stderr, "beaconchain-is-nil:%t shardchain-is-nil:%t", b1, b2,
)
os.Exit(-1)
}
node.BlockChannel = make(chan *types.Block) node.BlockChannel = make(chan *types.Block)
node.ConfirmedBlockChannel = make(chan *types.Block) node.ConfirmedBlockChannel = make(chan *types.Block)

Loading…
Cancel
Save