Cap nAttempts penalty at 8 and switch to pow instead of a division loop.
Cap nAttempts penalty at 8 and switch to pow instead of a division loop.

On hosts that had spent some time with a failed internet connection their
 nAttempts penalty was going through the roof (e.g. thousands for all peers)
 and as a result the connect search was pegging the CPU and failing to get
 more than a 4 connections after days of running (because it was taking so
 long per try).

Rebased-From: a784f90c9892f06b9fea4e7579f5eca3585482c3
Github-Pull: #6029

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