[tests] fix flakiness in sendheaders.py
[tests] fix flakiness in sendheaders.py

Fixes to sources of intermittent failure in sendheaders.py

- at the start of test_null_locators(), a new block is generated and
then a getheaders is sent. check_last_accouncement() is called to assert
that the headers message is received. However, the new block triggers an
inv to be sent over both P2P connections, so there's a race. If the inv
is received at the wrong time, the test fails.

- test_null_locators() ends by sending a block to the node under test.
At the start of test_nonnull_locators(), a block is mined and
check_last_announcement() is called to assert that the inv received is
for the same block. That means there's a race: if the inv from the block
sent in test_null_locators() is received at the wrong time, the test
fails.

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