fix InvalidateBlock to repopulate setBlockIndexCandidates
fix InvalidateBlock to repopulate setBlockIndexCandidates

Rebased-From: a9af415887f03cb2565895bc55be72748549e527
Github-Pull: #5879

HeliumGas/helium,capitalDIGI/DIGI-v-0-10-4,genavarov/brcoin,oklink-dev/bitcoin,thelazier/dash,rdqw/sscoin,ColossusCoinXT/ColossusCoinXT,presstab/PIVX,benzmuircroft/REWIRE.io,rdqw/sscoin,48thct2jtnf/P,UdjinM6/dash,ivansib/sibcoin,ahmedbodi/test2,MazaCoin/mazacoin-new,OstlerDev/florincoin,dashpay/dash,worldbit/worldbit,OstlerDev/florincoin,thelazier/dash,OmniLayer/omnicore,pelorusjack/BlockDX,keesdewit82/LasVegasCoin,slingcoin/sling-market,BlockchainTechLLC/3dcoin,LIMXTEC/DMDv3,OmniLayer/omnicore,truthcoin/blocksize-market,putinclassic/putic,lakepay/lake,aburan28/elements,sipa/elements,octocoin-project/octocoin,LIMXTEC/DMDv3,ivansib/sibcoin,xuyangcn/opalcoin,MonetaryUnit/MUE-Src,MazaCoin/mazacoin-new,schinzelh/dash,mapineda/litecoin,midnight-miner/LasVegasCoin,pelorusjack/BlockDX,fullcoins/fullcoin,KibiCoin/kibicoin,joulecoin/joulecoin,joulecoin/joulecoin,Mrs-X/PIVX,genavarov/lamacoin,rdqw/sscoin,genavarov/lamacoin,joulecoin/joulecoin,gwillen/elements,ptschip/bitcoinxt,xuyangcn/opalcoin,willwray/dash,pascalguru/florincoin,UdjinM6/dash,puticcoin/putic,presstab/PIVX,ticclassic/ic,fullcoins/fullcoin,biblepay/biblepay,capitalDIGI/DIGI-v-0-10-4,jmgilbert2/energi,axelxod/braincoin,aburan28/elements,ArgonToken/ArgonToken,ColossusCoinXT/ColossusCoinXT,DynamicCoinOrg/DMC,mockcoin/mockcoin,freelion93/mtucicoin,sipa/elements,joulecoin/joulecoin,sipa/elements,freelion93/mtucicoin,projectinterzone/ITZ,nmarley/dash,Kenwhite23/litecoin,apoelstra/elements,Mrs-X/Darknet,mikehearn/bitcoinxt,grumpydevelop/singularity,apoelstra/elements,ahmedbodi/test2,aburan28/elements,alejandromgk/Lunar,worldbit/worldbit,joulecoin/joulecoin,aspirecoin/aspire,dmrtsvetkov/flowercoin,ivansib/sib16,ivansib/sibcoin,zottejos/merelcoin,dashpay/dash,slingcoin/sling-market,ionomy/ion,aspirecoin/aspire,upgradeadvice/MUE-Src,florincoin/florincoin,Darknet-Crypto/Darknet,mockcoin/mockcoin,xawksow/GroestlCoin,sipa/elements,droark/elements,coinkeeper/2015-06-22_18-52_viacoin,pascalguru/florincoin,axelxod/braincoin,Mrs-X/Darknet,pinkevich/dash,48thct2jtnf/P,jtimon/elements,ediston/energi,coinkeeper/2015-06-22_18-52_viacoin,kleetus/bitcoinxt,my-first/octocoin,capitalDIGI/litecoin,dev1972/Satellitecoin,BlockchainTechLLC/3dcoin,xuyangcn/opalcoin,HeliumGas/helium,Electronic-Gulden-Foundation/egulden,inkvisit/sarmacoins,ediston/energi,CoinProjects/AmsterdamCoin-v4,Vsync-project/Vsync,cerebrus29301/crowncoin,dev1972/Satellitecoin,xawksow/GroestlCoin,apoelstra/elements,48thct2jtnf/P,dev1972/Satellitecoin,KibiCoin/kibicoin,sipa/elements,RibbitFROG/ribbitcoin,pascalguru/florincoin,cerebrus29301/crowncoin,xawksow/GroestlCoin,mapineda/litecoin,ColossusCoinXT/ColossusCoinXT,ptschip/bitcoinxt,lakepay/lake,DynamicCoinOrg/DMC,mapineda/litecoin,jtimon/elements,MazaCoin/maza,freelion93/mtucicoin,presstab/PIVX,gwillen/elements,UdjinM6/dash,Rav3nPL/doubloons-0.10,KibiCoin/kibicoin,OstlerDev/florincoin,zottejos/merelcoin,LIMXTEC/DMDv3,ionomy/ion,Electronic-Gulden-Foundation/egulden,schinzelh/dash,pascalguru/florincoin,rdqw/sscoin,ionomy/ion,Kenwhite23/litecoin,midnight-miner/LasVegasCoin,biblepay/biblepay,worldbit/worldbit,DynamicCoinOrg/DMC,Mrs-X/Darknet,npccoin/npccoin,UdjinM6/dash,putinclassic/putic,dashpay/dash,Vsync-project/Vsync,NunoEdgarGub1/elements,Rav3nPL/doubloons-0.10,PIVX-Project/PIVX,jmgilbert2/energi,aspirecoin/aspire,genavarov/lamacoin,xawksow/GroestlCoin,alejandromgk/Lunar,koharjidan/litecoin,axelxod/braincoin,CoinProjects/AmsterdamCoin-v4,crowning-/dash,puticcoin/putic,dev1972/Satellitecoin,GwangJin/gwangmoney-core,okinc/bitcoin,schinzelh/dash,Mrs-X/PIVX,nmarley/dash,capitalDIGI/DIGI-v-0-10-4,alejandromgk/Lunar,LIMXTEC/DMDv3,Rav3nPL/doubloons-0.10,ticclassic/ic,fullcoins/fullcoin,rdqw/sscoin,pascalguru/florincoin,Bloom-Project/Bloom,freelion93/mtucicoin,jtimon/elements,DynamicCoinOrg/DMC,ediston/energi,terracoin/terracoin,truthcoin/blocksize-market,dmrtsvetkov/flowercoin,PandaPayProject/PandaPay,rsdevgun16e/energi,crowning-/dash,aburan28/elements,ivansib/sib16,crowning-/dash,grumpydevelop/singularity,mockcoin/mockcoin,willwray/dash,antcheck/antcoin,willwray/dash,gwillen/elements,CoinProjects/AmsterdamCoin-v4,gwillen/elements,pelorusjack/BlockDX,DMDcoin/Diamond,MazaCoin/mazacoin-new,MonetaryUnit/MUE-Src,ediston/energi,zottejos/merelcoin,Darknet-Crypto/Darknet,NunoEdgarGub1/elements,CoinProjects/AmsterdamCoin-v4,genavarov/lamacoin,terracoin/terracoin,rsdevgun16e/energi,GwangJin/gwangmoney-core,droark/elements,keesdewit82/LasVegasCoin,pascalguru/florincoin,NunoEdgarGub1/elements,slingcoin/sling-market,oklink-dev/bitcoin,alejandromgk/Lunar,npccoin/npccoin,midnight-miner/LasVegasCoin,octocoin-project/octocoin,xawksow/GroestlCoin,mycointest/owncoin,genavarov/ladacoin,biblepay/biblepay,kleetus/bitcoinxt,pelorusjack/BlockDX,mockcoin/mockcoin,capitalDIGI/litecoin,48thct2jtnf/P,DynamicCoinOrg/DMC,kleetus/bitcoinxt,diggcoin/diggcoin,Vsync-project/Vsync,nmarley/dash,rsdevgun16e/energi,DMDcoin/Diamond,fullcoins/fullcoin,genavarov/brcoin,Vsync-project/Vsync,Bloom-Project/Bloom,fussl/elements,coinkeeper/2015-06-22_18-52_viacoin,grumpydevelop/singularity,midnight-miner/LasVegasCoin,keesdewit82/LasVegasCoin,octocoin-project/octocoin,genavarov/ladacoin,MazaCoin/maza,my-first/octocoin,aspirecoin/aspire,Petr-Economissa/gvidon,lakepay/lake,MazaCoin/mazacoin-new,npccoin/npccoin,kleetus/bitcoinxt,mockcoin/mockcoin,Darknet-Crypto/Darknet,octocoin-project/octocoin,pstratem/elements,oklink-dev/bitcoin,xuyangcn/opalcoin,axelxod/braincoin,jmgilbert2/energi,Mrs-X/PIVX,PIVX-Project/PIVX,MazaCoin/maza,terracoin/terracoin,pinkevich/dash,cerebrus29301/crowncoin,putinclassic/putic,Mrs-X/Darknet,capitalDIGI/litecoin,dmrtsvetkov/flowercoin,capitalDIGI/litecoin,Rav3nPL/doubloons-0.10,fussl/elements,ArgonToken/ArgonToken,presstab/PIVX,alejandromgk/Lunar,CoinProjects/AmsterdamCoin-v4,truthcoin/blocksize-market,Rav3nPL/doubloons-0.10,Mrs-X/PIVX,kleetus/bitcoinxt,antcheck/antcoin,Mrs-X/Darknet,PIVX-Project/PIVX,my-first/octocoin,crowning-/dash,ivansib/sibcoin,okinc/bitcoin,joulecoin/joulecoin,48thct2jtnf/P,apoelstra/elements,tropa/axecoin,projectinterzone/ITZ,genavarov/brcoin,pelorusjack/BlockDX,inkvisit/sarmacoins,ivansib/sib16,RyanLucchese/energi,PIVX-Project/PIVX,PandaPayProject/PandaPay,capitalDIGI/litecoin,keesdewit82/LasVegasCoin,capitalDIGI/DIGI-v-0-10-4,capitalDIGI/DIGI-v-0-10-4,puticcoin/putic,biblepay/biblepay,Rav3nPL/doubloons-0.10,MazaCoin/mazacoin-new,ionomy/ion,puticcoin/putic,tropa/axecoin,ivansib/sib16,48thct2jtnf/P,benzmuircroft/REWIRE.io,biblepay/biblepay,pstratem/elements,ionomy/ion,Vsync-project/Vsync,pelorusjack/BlockDX,Bloom-Project/Bloom,PIVX-Project/PIVX,puticcoin/putic,schinzelh/dash,crowning-/dash,pinkevich/dash,okinc/bitcoin,mycointest/owncoin,dashpay/dash,worldbit/worldbit,Petr-Economissa/gvidon,Thracky/monkeycoin,genavarov/ladacoin,antcheck/antcoin,putinclassic/putic,genavarov/ladacoin,jtimon/elements,projectinterzone/ITZ,okinc/bitcoin,Darknet-Crypto/Darknet,slingcoin/sling-market,antcheck/antcoin,putinclassic/putic,fullcoins/fullcoin,ivansib/sib16,RyanLucchese/energi,dashpay/dash,KibiCoin/kibicoin,upgradeadvice/MUE-Src,ticclassic/ic,NunoEdgarGub1/elements,PandaPayProject/PandaPay,ptschip/bitcoinxt,PIVX-Project/PIVX,pinkevich/dash,crowning-/dash,capitalDIGI/litecoin,koharjidan/litecoin,pstratem/elements,fussl/elements,genavarov/brcoin,Kenwhite23/litecoin,kleetus/bitcoinxt,mikehearn/bitcoinxt,truthcoin/blocksize-market,PandaPayProject/PandaPay,droark/elements,OmniLayer/omnicore,projectinterzone/ITZ,okinc/bitcoin,ingresscoin/ingresscoin,keesdewit82/LasVegasCoin,ahmedbodi/test2,Kenwhite23/litecoin,npccoin/npccoin,HeliumGas/helium,lakepay/lake,ptschip/bitcoinxt,OstlerDev/florincoin,Petr-Economissa/gvidon,ingresscoin/ingresscoin,OstlerDev/florincoin,cerebrus29301/crowncoin,oklink-dev/bitcoin,biblepay/biblepay,diggcoin/diggcoin,upgradeadvice/MUE-Src,ingresscoin/ingresscoin,ediston/energi,KibiCoin/kibicoin,truthcoin/blocksize-market,zottejos/merelcoin,upgradeadvice/MUE-Src,lakepay/lake,nmarley/dash,lakepay/lake,genavarov/brcoin,NunoEdgarGub1/elements,my-first/octocoin,dmrtsvetkov/flowercoin,Electronic-Gulden-Foundation/egulden,Kenwhite23/litecoin,xuyangcn/opalcoin,ArgonToken/ArgonToken,ivansib/sib16,Mrs-X/PIVX,thelazier/dash,DMDcoin/Diamond,xuyangcn/opalcoin,slingcoin/sling-market,dmrtsvetkov/flowercoin,my-first/octocoin,florincoin/florincoin,thelazier/dash,DMDcoin/Diamond,ionomy/ion,Electronic-Gulden-Foundation/egulden,DynamicCoinOrg/DMC,benzmuircroft/REWIRE.io,oklink-dev/bitcoin,mikehearn/bitcoinxt,RibbitFROG/ribbitcoin,grumpydevelop/singularity,octocoin-project/octocoin,ArgonToken/ArgonToken,koharjidan/litecoin,ediston/energi,dev1972/Satellitecoin,ArgonToken/ArgonToken,xawksow/GroestlCoin,RibbitFROG/ribbitcoin,alejandromgk/Lunar,capitalDIGI/DIGI-v-0-10-4,apoelstra/elements,midnight-miner/LasVegasCoin,mikehearn/bitcoinxt,koharjidan/litecoin,pstratem/elements,truthcoin/blocksize-market,genavarov/ladacoin,Bloom-Project/Bloom,genavarov/lamacoin,MazaCoin/maza,HeliumGas/helium,okinc/bitcoin,coinkeeper/2015-06-22_18-52_viacoin,freelion93/mtucicoin,aburan28/elements,jmgilbert2/energi,DMDcoin/Diamond,diggcoin/diggcoin,UdjinM6/dash,MonetaryUnit/MUE-Src,MazaCoin/maza,Thracky/monkeycoin,cerebrus29301/crowncoin,gwillen/elements,Bloom-Project/Bloom,mycointest/owncoin,Electronic-Gulden-Foundation/egulden,mapineda/litecoin,coinkeeper/2015-06-22_18-52_viacoin,upgradeadvice/MUE-Src,biblepay/biblepay,worldbit/worldbit,diggcoin/diggcoin,LIMXTEC/DMDv3,benzmuircroft/REWIRE.io,OmniLayer/omnicore,pinkevich/dash,dmrtsvetkov/flowercoin,MazaCoin/maza,grumpydevelop/singularity,PandaPayProject/PandaPay,fussl/elements,ticclassic/ic,CoinProjects/AmsterdamCoin-v4,ingresscoin/ingresscoin,Darknet-Crypto/Darknet,nmarley/dash,grumpydevelop/singularity,tropa/axecoin,fullcoins/fullcoin,aspirecoin/aspire,zottejos/merelcoin,BlockchainTechLLC/3dcoin,BlockchainTechLLC/3dcoin,willwray/dash,jtimon/elements,RyanLucchese/energi,sipa/elements,ivansib/sibcoin,Thracky/monkeycoin,GwangJin/gwangmoney-core,benzmuircroft/REWIRE.io,ahmedbodi/test2,apoelstra/elements,projectinterzone/ITZ,worldbit/worldbit,antcheck/antcoin,npccoin/npccoin,PIVX-Project/PIVX,nmarley/dash,Thracky/monkeycoin,terracoin/terracoin,Petr-Economissa/gvidon,PIVX-Project/PIVX,mycointest/owncoin,mikehearn/bitcoinxt,ColossusCoinXT/ColossusCoinXT,PandaPayProject/PandaPay,Petr-Economissa/gvidon,florincoin/florincoin,coinkeeper/2015-06-22_18-52_viacoin,mycointest/owncoin,axelxod/braincoin,droark/elements,RyanLucchese/energi,KibiCoin/kibicoin,inkvisit/sarmacoins,PIVX-Project/PIVX,octocoin-project/octocoin,midnight-miner/LasVegasCoin,genavarov/ladacoin,OmniLayer/omnicore,Darknet-Crypto/Darknet,BlockchainTechLLC/3dcoin,genavarov/brcoin,puticcoin/putic,OstlerDev/florincoin,slingcoin/sling-market,rdqw/sscoin,ahmedbodi/test2,oklink-dev/bitcoin,aburan28/elements,rsdevgun16e/energi,dev1972/Satellitecoin,Vsync-project/Vsync,rsdevgun16e/energi,mycointest/owncoin,DMDcoin/Diamond,GwangJin/gwangmoney-core,antcheck/antcoin,jtimon/elements,freelion93/mtucicoin,upgradeadvice/MUE-Src,droark/elements,mockcoin/mockcoin,MazaCoin/mazacoin-new,nmarley/dash,jmgilbert2/energi,zottejos/merelcoin,my-first/octocoin,florincoin/florincoin,MonetaryUnit/MUE-Src,ColossusCoinXT/ColossusCoinXT,ticclassic/ic,pinkevich/dash,tropa/axecoin,Mrs-X/PIVX,inkvisit/sarmacoins,inkvisit/sarmacoins,diggcoin/diggcoin,ticclassic/ic,RibbitFROG/ribbitcoin,ColossusCoinXT/ColossusCoinXT,florincoin/florincoin,Mrs-X/Darknet,axelxod/braincoin,presstab/PIVX,RyanLucchese/energi,ptschip/bitcoinxt,Bloom-Project/Bloom,putinclassic/putic,schinzelh/dash,ahmedbodi/test2,Thracky/monkeycoin,schinzelh/dash,fussl/elements,aspirecoin/aspire,inkvisit/sarmacoins,willwray/dash,npccoin/npccoin,koharjidan/litecoin,pstratem/elements,presstab/PIVX,willwray/dash,fussl/elements,Thracky/monkeycoin,ingresscoin/ingresscoin,MonetaryUnit/MUE-Src,cerebrus29301/crowncoin,ArgonToken/ArgonToken,rsdevgun16e/energi,OmniLayer/omnicore,tropa/axecoin,BlockchainTechLLC/3dcoin,keesdewit82/LasVegasCoin,NunoEdgarGub1/elements,HeliumGas/helium,Kenwhite23/litecoin,benzmuircroft/REWIRE.io,thelazier/dash,ivansib/sibcoin,jmgilbert2/energi,genavarov/lamacoin,RibbitFROG/ribbitcoin,mikehearn/bitcoinxt,Petr-Economissa/gvidon,florincoin/florincoin,HeliumGas/helium,RyanLucchese/energi,LIMXTEC/DMDv3,mapineda/litecoin,koharjidan/litecoin,gwillen/elements,terracoin/terracoin,Electronic-Gulden-Foundation/egulden,droark/elements,ingresscoin/ingresscoin,RibbitFROG/ribbitcoin,MonetaryUnit/MUE-Src,tropa/axecoin,pstratem/elements,ptschip/bitcoinxt,diggcoin/diggcoin,biblepay/biblepay,mapineda/litecoin,terracoin/terracoin