Fix fast-shutdown crash if genesis block was not loaded
Fix fast-shutdown crash if genesis block was not loaded

If the ShutdownRequested() check at the top of ActivateBestChain()
returns false during initial genesis block load we will fail an
assertion in UTXO DB flush as the best block hash IsNull(). To work
around this, we move the check until after one round of
ActivateBestChainStep(), ensuring the genesis block gets connected.

joshrabinowitz/bitcoin,jonasschnelli/bitcoin,paveljanik/bitcoin,wellenreiter01/Feathercoin,r8921039/bitcoin,gjhiggins/vcoincore,FeatherCoin/Feathercoin,mruddy/bitcoin,andreaskern/bitcoin,lbryio/lbrycrd,monacoinproject/monacoin,EthanHeilman/bitcoin,BTCGPU/BTCGPU,tjps/bitcoin,jamesob/bitcoin,mitchellcash/bitcoin,qtumproject/qtum,apoelstra/bitcoin,peercoin/peercoin,bespike/litecoin,mm-s/bitcoin,CryptArc/bitcoin,domob1812/huntercore,ericshawlinux/bitcoin,MarcoFalke/bitcoin,namecoin/namecoin-core,jlopp/statoshi,h4x3rotab/BTCGPU,rawodb/bitcoin,h4x3rotab/BTCGPU,CryptArc/bitcoin,droark/bitcoin,jlopp/statoshi,nikkitan/bitcoin,anditto/bitcoin,sebrandon1/bitcoin,Christewart/bitcoin,practicalswift/bitcoin,bitcoinknots/bitcoin,n1bor/bitcoin,myriadcoin/myriadcoin,OmniLayer/omnicore,anditto/bitcoin,myriadteam/myriadcoin,GroestlCoin/GroestlCoin,bespike/litecoin,AkioNak/bitcoin,achow101/bitcoin,ryanofsky/bitcoin,TheBlueMatt/bitcoin,jlopp/statoshi,ahmedbodi/vertcoin,GroestlCoin/bitcoin,fanquake/bitcoin,fujicoin/fujicoin,lateminer/bitcoin,namecoin/namecoin-core,dscotese/bitcoin,cdecker/bitcoin,bespike/litecoin,RHavar/bitcoin,yenliangl/bitcoin,litecoin-project/litecoin,litecoin-project/litecoin,peercoin/peercoin,Bushstar/UFO-Project,BTCGPU/BTCGPU,AkioNak/bitcoin,pstratem/bitcoin,yenliangl/bitcoin,tecnovert/particl-core,prusnak/bitcoin,joshrabinowitz/bitcoin,apoelstra/bitcoin,instagibbs/bitcoin,FeatherCoin/Feathercoin,litecoin-project/litecoin,jmcorgan/bitcoin,bitcoin/bitcoin,jmcorgan/bitcoin,n1bor/bitcoin,ericshawlinux/bitcoin,peercoin/peercoin,practicalswift/bitcoin,Xekyo/bitcoin,pataquets/namecoin-core,Flowdalic/bitcoin,mm-s/bitcoin,dscotese/bitcoin,JeremyRubin/bitcoin,wellenreiter01/Feathercoin,domob1812/bitcoin,myriadteam/myriadcoin,Flowdalic/bitcoin,midnightmagic/bitcoin,stamhe/bitcoin,TheBlueMatt/bitcoin,JeremyRubin/bitcoin,sebrandon1/bitcoin,domob1812/namecore,jamesob/bitcoin,jnewbery/bitcoin,DigitalPandacoin/pandacoin,jnewbery/bitcoin,CryptArc/bitcoin,prusnak/bitcoin,cdecker/bitcoin,MarcoFalke/bitcoin,JeremyRubin/bitcoin,mm-s/bitcoin,prusnak/bitcoin,BTCGPU/BTCGPU,globaltoken/globaltoken,mitchellcash/bitcoin,alecalve/bitcoin,bitcoin/bitcoin,nikkitan/bitcoin,ajtowns/bitcoin,globaltoken/globaltoken,GlobalBoost/GlobalBoost,rnicoll/bitcoin,bitcoinsSG/bitcoin,domob1812/namecore,fujicoin/fujicoin,bitcoinknots/bitcoin,TheBlueMatt/bitcoin,practicalswift/bitcoin,RHavar/bitcoin,JeremyRubin/bitcoin,jtimon/bitcoin,myriadteam/myriadcoin,lateminer/bitcoin,tjps/bitcoin,lbryio/lbrycrd,vmp32k/litecoin,Sjors/bitcoin,GroestlCoin/GroestlCoin,fujicoin/fujicoin,ryanofsky/bitcoin,GroestlCoin/GroestlCoin,rnicoll/bitcoin,domob1812/huntercore,nikkitan/bitcoin,EthanHeilman/bitcoin,sstone/bitcoin,dscotese/bitcoin,domob1812/bitcoin,vmp32k/litecoin,Kogser/bitcoin,Kogser/bitcoin,RHavar/bitcoin,Bushstar/UFO-Project,joshrabinowitz/bitcoin,globaltoken/globaltoken,BTCGPU/BTCGPU,lbryio/lbrycrd,digibyte/digibyte,namecoin/namecore,anditto/bitcoin,myriadcoin/myriadcoin,instagibbs/bitcoin,tecnovert/particl-core,donaloconnor/bitcoin,namecoin/namecore,h4x3rotab/BTCGPU,sipsorcery/bitcoin,untrustbank/litecoin,DigitalPandacoin/pandacoin,wellenreiter01/Feathercoin,rnicoll/bitcoin,pataquets/namecoin-core,guncoin/guncoin,pataquets/namecoin-core,Sjors/bitcoin,sipsorcery/bitcoin,fujicoin/fujicoin,yenliangl/bitcoin,vmp32k/litecoin,GlobalBoost/GlobalBoost,Christewart/bitcoin,r8921039/bitcoin,kazcw/bitcoin,GroestlCoin/GroestlCoin,MarcoFalke/bitcoin,fujicoin/fujicoin,lateminer/bitcoin,afk11/bitcoin,thrasher-/litecoin,bitcoinsSG/bitcoin,mitchellcash/bitcoin,jonasschnelli/bitcoin,peercoin/peercoin,midnightmagic/bitcoin,midnightmagic/bitcoin,cdecker/bitcoin,particl/particl-core,yenliangl/bitcoin,DigitalPandacoin/pandacoin,OmniLayer/omnicore,EthanHeilman/bitcoin,donaloconnor/bitcoin,untrustbank/litecoin,Christewart/bitcoin,bespike/litecoin,qtumproject/qtum,namecoin/namecore,tjps/bitcoin,cdecker/bitcoin,Kogser/bitcoin,qtumproject/qtum,jmcorgan/bitcoin,Bushstar/UFO-Project,GroestlCoin/bitcoin,bitcoin/bitcoin,stamhe/bitcoin,MeshCollider/bitcoin,jnewbery/bitcoin,bitcoinsSG/bitcoin,paveljanik/bitcoin,ryanofsky/bitcoin,namecoin/namecore,GroestlCoin/bitcoin,monacoinproject/monacoin,JeremyRubin/bitcoin,jtimon/bitcoin,Christewart/bitcoin,domob1812/huntercore,Kogser/bitcoin,FeatherCoin/Feathercoin,pstratem/bitcoin,AkioNak/bitcoin,mm-s/bitcoin,namecoin/namecore,monacoinproject/monacoin,myriadcoin/myriadcoin,ryanofsky/bitcoin,DigitalPandacoin/pandacoin,ahmedbodi/vertcoin,midnightmagic/bitcoin,domob1812/huntercore,dscotese/bitcoin,ericshawlinux/bitcoin,namecoin/namecoin-core,lateminer/bitcoin,digibyte/digibyte,jamesob/bitcoin,myriadteam/myriadcoin,thrasher-/litecoin,Kogser/bitcoin,bitcoinsSG/bitcoin,Kogser/bitcoin,andreaskern/bitcoin,jnewbery/bitcoin,qtumproject/qtum,droark/bitcoin,ElementsProject/elements,sebrandon1/bitcoin,myriadcoin/myriadcoin,EthanHeilman/bitcoin,AkioNak/bitcoin,donaloconnor/bitcoin,GlobalBoost/GlobalBoost,kazcw/bitcoin,BTCGPU/BTCGPU,namecoin/namecore,lbryio/lbrycrd,particl/particl-core,OmniLayer/omnicore,RHavar/bitcoin,Xekyo/bitcoin,prusnak/bitcoin,anditto/bitcoin,fanquake/bitcoin,Sjors/bitcoin,Flowdalic/bitcoin,pstratem/bitcoin,fanquake/bitcoin,sipsorcery/bitcoin,domob1812/bitcoin,MarcoFalke/bitcoin,untrustbank/litecoin,gjhiggins/vcoincore,kallewoof/bitcoin,domob1812/bitcoin,jlopp/statoshi,rnicoll/dogecoin,sipsorcery/bitcoin,midnightmagic/bitcoin,rawodb/bitcoin,n1bor/bitcoin,sstone/bitcoin,vmp32k/litecoin,MeshCollider/bitcoin,thrasher-/litecoin,alecalve/bitcoin,lateminer/bitcoin,joshrabinowitz/bitcoin,jambolo/bitcoin,TheBlueMatt/bitcoin,BTCGPU/BTCGPU,litecoin-project/litecoin,prusnak/bitcoin,mruddy/bitcoin,EthanHeilman/bitcoin,vertcoin/vertcoin,sebrandon1/bitcoin,particl/particl-core,gjhiggins/vcoincore,gjhiggins/vcoincore,Kogser/bitcoin,sebrandon1/bitcoin,ajtowns/bitcoin,globaltoken/globaltoken,Xekyo/bitcoin,sstone/bitcoin,lbryio/lbrycrd,GlobalBoost/GlobalBoost,globaltoken/globaltoken,joshrabinowitz/bitcoin,myriadteam/myriadcoin,jambolo/bitcoin,MeshCollider/bitcoin,peercoin/peercoin,guncoin/guncoin,ahmedbodi/vertcoin,ElementsProject/elements,kazcw/bitcoin,litecoin-project/litecoin,digibyte/digibyte,vertcoin/vertcoin,wellenreiter01/Feathercoin,afk11/bitcoin,particl/particl-core,sstone/bitcoin,thrasher-/litecoin,ajtowns/bitcoin,andreaskern/bitcoin,Bushstar/UFO-Project,Bushstar/UFO-Project,litecoin-project/litecoin,pataquets/namecoin-core,untrustbank/litecoin,GroestlCoin/bitcoin,andreaskern/bitcoin,apoelstra/bitcoin,digibyte/digibyte,RHavar/bitcoin,anditto/bitcoin,sstone/bitcoin,jonasschnelli/bitcoin,thrasher-/litecoin,apoelstra/bitcoin,ajtowns/bitcoin,kallewoof/bitcoin,untrustbank/litecoin,alecalve/bitcoin,pstratem/bitcoin,droark/bitcoin,Sjors/bitcoin,Xekyo/bitcoin,randy-waterhouse/bitcoin,domob1812/huntercore,jnewbery/bitcoin,kallewoof/bitcoin,afk11/bitcoin,bitcoin/bitcoin,GroestlCoin/GroestlCoin,h4x3rotab/BTCGPU,MeshCollider/bitcoin,ericshawlinux/bitcoin,h4x3rotab/BTCGPU,jmcorgan/bitcoin,afk11/bitcoin,ElementsProject/elements,kazcw/bitcoin,donaloconnor/bitcoin,GroestlCoin/bitcoin,Sjors/bitcoin,achow101/bitcoin,GroestlCoin/GroestlCoin,EthanHeilman/bitcoin,rnicoll/dogecoin,jonasschnelli/bitcoin,practicalswift/bitcoin,ElementsProject/elements,wellenreiter01/Feathercoin,ahmedbodi/vertcoin,qtumproject/qtum,OmniLayer/omnicore,andreaskern/bitcoin,fanquake/bitcoin,jamesob/bitcoin,n1bor/bitcoin,yenliangl/bitcoin,Flowdalic/bitcoin,ahmedbodi/vertcoin,randy-waterhouse/bitcoin,ericshawlinux/bitcoin,sipsorcery/bitcoin,FeatherCoin/Feathercoin,gjhiggins/vcoincore,rawodb/bitcoin,jambolo/bitcoin,ajtowns/bitcoin,h4x3rotab/BTCGPU,rnicoll/dogecoin,practicalswift/bitcoin,thrasher-/litecoin,Kogser/bitcoin,cdecker/bitcoin,Bushstar/UFO-Project,GlobalBoost/GlobalBoost,DigitalPandacoin/pandacoin,particl/particl-core,domob1812/bitcoin,mm-s/bitcoin,stamhe/bitcoin,untrustbank/litecoin,jmcorgan/bitcoin,practicalswift/bitcoin,apoelstra/bitcoin,alecalve/bitcoin,rnicoll/bitcoin,jtimon/bitcoin,ahmedbodi/vertcoin,mruddy/bitcoin,mitchellcash/bitcoin,ryanofsky/bitcoin,myriadcoin/myriadcoin,bitcoinknots/bitcoin,paveljanik/bitcoin,donaloconnor/bitcoin,prusnak/bitcoin,kazcw/bitcoin,jtimon/bitcoin,paveljanik/bitcoin,GroestlCoin/bitcoin,Flowdalic/bitcoin,CryptArc/bitcoin,mruddy/bitcoin,lbryio/lbrycrd,MeshCollider/bitcoin,sebrandon1/bitcoin,afk11/bitcoin,rnicoll/bitcoin,domob1812/bitcoin,OmniLayer/omnicore,randy-waterhouse/bitcoin,achow101/bitcoin,bitcoinsSG/bitcoin,myriadcoin/myriadcoin,tecnovert/particl-core,r8921039/bitcoin,stamhe/bitcoin,andreaskern/bitcoin,n1bor/bitcoin,guncoin/guncoin,instagibbs/bitcoin,myriadteam/myriadcoin,jtimon/bitcoin,GlobalBoost/GlobalBoost,r8921039/bitcoin,alecalve/bitcoin,Xekyo/bitcoin,tecnovert/particl-core,GlobalBoost/GlobalBoost,vertcoin/vertcoin,kallewoof/bitcoin,vertcoin/vertcoin,CryptArc/bitcoin,bitcoin/bitcoin,jmcorgan/bitcoin,joshrabinowitz/bitcoin,tecnovert/particl-core,stamhe/bitcoin,mitchellcash/bitcoin,jambolo/bitcoin,JeremyRubin/bitcoin,guncoin/guncoin,instagibbs/bitcoin,kazcw/bitcoin,MarcoFalke/bitcoin,TheBlueMatt/bitcoin,rawodb/bitcoin,midnightmagic/bitcoin,alecalve/bitcoin,lbryio/lbrycrd,domob1812/namecore,instagibbs/bitcoin,jamesob/bitcoin,ajtowns/bitcoin,jambolo/bitcoin,tjps/bitcoin,jambolo/bitcoin,anditto/bitcoin,vertcoin/vertcoin,cdecker/bitcoin,Kogser/bitcoin,namecoin/namecoin-core,mm-s/bitcoin,Christewart/bitcoin,vmp32k/litecoin,rnicoll/dogecoin,mruddy/bitcoin,achow101/bitcoin,TheBlueMatt/bitcoin,qtumproject/qtum,rnicoll/dogecoin,mitchellcash/bitcoin,FeatherCoin/Feathercoin,bitcoin/bitcoin,r8921039/bitcoin,gjhiggins/vcoincore,MarcoFalke/bitcoin,MeshCollider/bitcoin,pataquets/namecoin-core,randy-waterhouse/bitcoin,achow101/bitcoin,Kogser/bitcoin,tjps/bitcoin,fujicoin/fujicoin,kallewoof/bitcoin,jlopp/statoshi,achow101/bitcoin,mruddy/bitcoin,jonasschnelli/bitcoin,droark/bitcoin,digibyte/digibyte,namecoin/namecoin-core,nikkitan/bitcoin,pstratem/bitcoin,tecnovert/particl-core,OmniLayer/omnicore,pstratem/bitcoin,domob1812/namecore,AkioNak/bitcoin,dscotese/bitcoin,CryptArc/bitcoin,domob1812/namecore,RHavar/bitcoin,guncoin/guncoin,ElementsProject/elements,tjps/bitcoin,globaltoken/globaltoken,monacoinproject/monacoin,vmp32k/litecoin,domob1812/huntercore,paveljanik/bitcoin,rnicoll/bitcoin,dscotese/bitcoin,nikkitan/bitcoin,fanquake/bitcoin,Kogser/bitcoin,afk11/bitcoin,AkioNak/bitcoin,jamesob/bitcoin,ryanofsky/bitcoin,bitcoinknots/bitcoin,bespike/litecoin,rawodb/bitcoin,ericshawlinux/bitcoin,ElementsProject/elements,sstone/bitcoin,fanquake/bitcoin,kallewoof/bitcoin,rawodb/bitcoin,wellenreiter01/Feathercoin,droark/bitcoin,lateminer/bitcoin,paveljanik/bitcoin,r8921039/bitcoin,digibyte/digibyte,guncoin/guncoin,randy-waterhouse/bitcoin,sipsorcery/bitcoin,domob1812/namecore,donaloconnor/bitcoin,pataquets/namecoin-core,instagibbs/bitcoin,monacoinproject/monacoin,stamhe/bitcoin,randy-waterhouse/bitcoin,n1bor/bitcoin,qtumproject/qtum,nikkitan/bitcoin,vertcoin/vertcoin,peercoin/peercoin,FeatherCoin/Feathercoin,Flowdalic/bitcoin,bitcoinsSG/bitcoin,Kogser/bitcoin,Christewart/bitcoin,bespike/litecoin,Xekyo/bitcoin,yenliangl/bitcoin,apoelstra/bitcoin,particl/particl-core,droark/bitcoin,monacoinproject/monacoin,bitcoinknots/bitcoin,jlopp/statoshi,namecoin/namecoin-core,DigitalPandacoin/pandacoin,jtimon/bitcoin