Do not send (potentially) invalid headers in response to getheaders
Do not send (potentially) invalid headers in response to getheaders

Nowhere else in the protocol do we send headers which are for
blocks we have not fully validated except in response to getheaders
messages with a null locator. On my public node I have not seen any
such request (whether for an invalid block or not) in at least two
years of debug.log output, indicating that this should have minimal
impact.

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