Optimization: only test for witness scripts at top level
Optimization: only test for witness scripts at top level

Inside P2SH scripts we already know that the P2SH script version of witness keys/scripts
are acceptable, so there is no need to test for it again.

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