From f84ebfa7f48736d8d6fefe767bb200d10d88b43a Mon Sep 17 00:00:00 2001 From: Edgar Aroutiounian Date: Fri, 13 Dec 2019 18:03:52 -0800 Subject: [PATCH] [node] Exit program if either shardchain or beaconchain is nil (#2030) --- node/node.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/node/node.go b/node/node.go index 303f4e991..e2f465b89 100644 --- a/node/node.go +++ b/node/node.go @@ -3,6 +3,7 @@ package node import ( "crypto/ecdsa" "fmt" + "os" "sync" "time" @@ -435,6 +436,12 @@ func New(host p2p.Host, consensusObj *consensus.Consensus, // Load the chains. blockchain := node.Blockchain() // this also sets node.isFirstTime if the DB is fresh 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.ConfirmedBlockChannel = make(chan *types.Block)