script: Change SignatureHash input index check to an assert.
script: Change SignatureHash input index check to an assert.

In the SignatureHash function, the input index must refer to a valid
index. This is not enforced equally in the segwit/non-segwit branches
and should be an assertion rather than returning a error hash.

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