Fix addrman crashes
Fix addrman crashes

A function returned the element to remove from a bucket, instead of its
position in that bucket. This function was only called when a tried
bucket overflowed, which only happens after many outgoing connections
have been made.

Closes: #1065, #1156

FuzzyBearBTC/Peershares,palm12341/jnc,Peerunity/Peerunity,jyap808/jumbucks,TheSeven/ppcoin,landcoin-ldc/landcoin,iadix/iadixcoin,blackcoinhelp/blackcoin,IOCoin/DIONS,peercoin/peercoin,TheSeven/ppcoin,5mil/SuperTurboStake,etercoin/etercoin,LanaCoin/lanacoin,valorbit/valorbit,FuzzyBearBTC/peercoin,elcrypto/Pulse,slimcoin-project/Slimcoin,som4paul/BolieC,LanaCoin/lanacoin,bitgrowchain/bitgrow,lateminer/DopeCoinGold,FuzzyBearBTC/Peerunity,prodigal-son/blackcoin,som4paul/BolieC,neureal/noocoin,fsb4000/novacoin,iceinsidefire/peershare-edit,iadix/iadixcoin,internaut-me/ppcoin,AquariusNetwork/ARCO,Stakemaker/OMFGcoin,benzhi888/renminbi,prodigal-son/blackcoin,neureal/noocoin,Ziftr/ppcoin,Peershares/Peershares,gfneto/Peershares,DigitalPandacoin/pandacoin,gades/novacoin,xranby/blackcoin,Action-Committee/Spaceballz,stamhe/novacoin,AquariusNetwork/ARCO,novacoin-project/novacoin,FuzzyBearBTC/Peershares2,greencoin-dev/GreenCoinV2,Whitecoin-org/Whitecoin,Peershares/Peershares,yacoin/yacoin,DigitalPandacoin/pandacoin,landcoin-ldc/landcoin,Whitecoin-org/Whitecoin,dopecoin-dev/DopeCoinGold,Magicking/neucoin,TurboStake/TurboStake,blackcoinhelp/blackcoin,dopecoin-dev/DopeCoinGold,jashandeep-sohi/ppcoin,FuzzyBearBTC/Fuzzyshares,iadix/iadixcoin,valorbit/valorbit-oss,som4paul/BolieC,elambert2014/novacoin,phorensic/yacoin,Magicking/neucoin,5mil/SuperTurboStake,pocopoco/yacoin,Ziftr/Peerunity,thunderrabbit/clams,jlay11/sharecoin,blackcoinhelp/blackcoin,ya4-old-c-coder/yacoin,stronghands/stronghands,dopecoin-dev/DopeCoinGold,sigmike/peercoin,stamhe/ppcoin,Someguy123/novafoil,okcashpro/okcash,Whitecoin-org/Whitecoin,novacoin-project/novacoin,daeMOn63/Peershares,nochowderforyou/clams,bitgrowchain/bitgrow,bitgrowchain/bitgrow,shadowproject/shadow,thodg/ppcoin,ghostlander/Testcoin,robvanmieghem/clams,5mil/Bolt,FuzzyBearBTC/Peershares2,sigmike/peercoin,byncoin-project/byncoin,penek/novacoin,lordsajan/erupee,redfish64/nomiccoin,peerdb/cors,prodigal-son/blackcoin,5mil/Bolt,FuzzyBearBTC/Peershares2,CoinGame/BCEShadow,sigmike/peercoin,redfish64/nomiccoin,pocopoco/yacoin,peercoin/peercoin,IOCoin/iocoin,coinkeeper/2015-06-22_18-45_peercoin,LanaCoin/lanacoin,Peerunity/Peerunity,iadix/iadixcoin,shadowproject/shadow,gorgoy/novacoin,CoinGame/BCEShadow,VsyncCrypto/Vsync,Action-Committee/Spaceballz,d5000/ppcoin,dopecoin-dev/DopeCoinGold,FuzzyBearBTC/Peershares,jlay11/sharecoin,CoinBlack/blackcoin,CoinBlack/bitcoin,byncoin-project/byncoin,rat4/blackcoin,IOCoin/iocoin,okcashpro/okcash,daeMOn63/Peershares,CoinBlack/bitcoin,elambert2014/novacoin,elambert2014/novacoin,Stakemaker/OMFGcoin,pinkmagicdev/SwagBucks,peercoin/peercoin,Whitecoin-org/Whitecoin,Crypto-Currency/BitBar,senadj/yacoin,Ziftr/ppcoin,benzhi888/renminbi,ghostlander/Orbitcoin,gorgoy/novacoin,fsb4000/novacoin,rat4/blackcoin,BeirdoMud/MudCoin,coinkeeper/2015-06-22_18-45_peercoin,penek/novacoin,AquariusNetwork/ARCO,iceinsidefire/peershare-edit,elambert2014/cbx2,nochowderforyou/clams,AquariusNetwork/ARCOv2,stronghands/stronghands,sigmike/peercoin,jlay11/sharecoin,lordsajan/erupee,jashandeep-sohi/ppcoin,rat4/blackcoin,byncoin-project/byncoin,Rimbit/Wallets,glv2/peerunity,iceinsidefire/peershare-edit,Crypto-Currency/BitBar,IOCoin/DIONS,FuzzyBearBTC/Peershares-1,jyap808/jumbucks,Jheguy2/Mercury,som4paul/BolieC,lateminer/DopeCoinGold,vectorcoindev/Vector,TheoremCrypto/TheoremCoin,Action-Committee/Spaceballz,GeopaymeEE/e-goldcoin,jlay11/sharecoin,ForceMajeure/BitPenny-Client,sproutcoin/sprouts,landcoin-ldc/landcoin,snakie/ppcoin,effectsToCause/vericoin,peerdb/cors,sproutcoin/sprouts,DigitalPandacoin/pandacoin,benzhi888/renminbi,iadix/iadixcoin,MOIN/moin,5mil/Bolt,pocopoco/yacoin,lentza/SuperTurboStake,BlueMeanie/PeerShares,BlueMeanie/PeerShares,iadix/iadixcoin,NeuCoin/neucoin,SproutsEx/SproutsExtreme,benzhi888/renminbi,ALEXIUMCOIN/alexium,snakie/ppcoin,landcoin-ldc/landcoin,FuzzyBearBTC/Peerunity,CoinGame/BCEShadowNet,5mil/Bolt,palm12341/jnc,jashandeep-sohi/ppcoin,peerdb/cors,dooglus/clams,phorensic/yacoin,gorgoy/novacoin,valorbit/valorbit-oss,ghostlander/Testcoin,okcashpro/okcash,benzhi888/renminbi,okcashpro/okcash,vizidrixfork/Peershares,robvanmieghem/clams,CoinBlack/bitcoin,vectorcoindev/Vector,lordsajan/erupee,thunderrabbit/clams,lordsajan/erupee,AquariusNetwork/ARCO,Crypto-Currency/BitBar,Jheguy2/Mercury,VsyncCrypto/Vsync,elambert2014/cbx2,lateminer/DopeCoinGold,AquariusNetwork/ARCO,iceinsidefire/peershare-edit,valorbit/valorbit-oss,TheSeven/ppcoin,elcrypto/Pulse,prodigal-son/blackcoin,senadj/yacoin,LanaCoin/lanacoin,vizidrixfork/Peershares,VsyncCrypto/Vsync,elambert2014/cbx2,elambert2014/novacoin,CoinGame/BCEShadow,CoinBlack/blackcoin,landcoin-ldc/landcoin,LanaCoin/lanacoin,ppcoin/ppcoin,penek/novacoin,GeopaymeEE/e-goldcoin,Someguy123/novafoil,okcashpro/okcash,gfneto/Peershares,ghostlander/Orbitcoin,coinkeeper/2015-06-22_18-45_peercoin,byncoin-project/byncoin,gades/novacoin,elambert2014/cbx2,CoinGame/NuShadowNet,fsb4000/novacoin,fsb4000/novacoin,elambert2014/cbx2,gades/novacoin,greencoin-dev/GreenCoinV2,daeMOn63/Peershares,ghostlander/Orbitcoin,SproutsEx/SproutsExtreme,dooglus/clams,peerdb/cors,lentza/SuperTurboStake,vectorcoindev/Vector,Ziftr/ppcoin,slimcoin-project/Slimcoin,etercoin/etercoin,bitgrowchain/bitgrow,CoinBlack/blackcoin,BlueMeanie/PeerShares,NeuCoin/neucoin,peercoin/peercoin,peercoin/peercoin,DigitalPandacoin/pandacoin,gades/novacoin,xranby/blackcoin,Jheguy2/Mercury,VsyncCrypto/Vsync,CoinGame/BCEShadowNet,stamhe/ppcoin,Kefkius/clams,valorbit/valorbit-oss,FuzzyBearBTC/Peershares-1,CoinGame/BCEShadowNet,FuzzyBearBTC/Peershares,novacoin-project/novacoin,vectorcoindev/Vector,SproutsEx/SproutsExtreme,stamhe/novacoin,MOIN/moin,MOIN/moin,Action-Committee/Spaceballz,NeuCoin/neucoin,TheoremCrypto/TheoremCoin,glv2/peerunity,pinkmagicdev/SwagBucks,FuzzyBearBTC/Fuzzyshares,DigitalPandacoin/pandacoin,TheSeven/ppcoin,elcrypto/Pulse,elambert2014/novacoin,CoinBlack/bitcoin,peerdb/cors,CoinBlack/blackcoin,Magicking/neucoin,FuzzyBearBTC/Peershares2,FuzzyBearBTC/Peershares-1,MoMoneyMonetarism/ppcoin,fsb4000/novacoin,lordsajan/erupee,CoinGame/BCEShadowNet,pinkmagicdev/SwagBucks,FuzzyBearBTC/Fuzzyshares,thodg/ppcoin,dooglus/clams,snakie/ppcoin,BlueMeanie/PeerShares,TheoremCrypto/TheoremCoin,MoMoneyMonetarism/ppcoin,gades/novacoin,MoMoneyMonetarism/ppcoin,dooglus/clams,pocopoco/yacoin,valorbit/valorbit-oss,Rimbit/Wallets,pinkmagicdev/SwagBucks,Ziftr/ppcoin,jlay11/sharecoin,greencoin-dev/GreenCoinV2,CoinBlack/bitcoin,CoinGame/BCEShadow,Ziftr/Peerunity,5mil/SuperTurboStake,novacoin-project/novacoin,penek/novacoin,Jheguy2/Mercury,5mil/SuperTurboStake,slimcoin-project/Slimcoin,lordsajan/erupee,snakie/ppcoin,CoinGame/BCEShadow,ya4-old-c-coder/yacoin,Ziftr/Peerunity,iadix/iadixcoin,shadowproject/shadow,iadix/iadixcoin,gorgoy/novacoin,stamhe/novacoin,phorensic/yacoin,ForceMajeure/BitPenny-Client,robvanmieghem/clams,ALEXIUMCOIN/alexium,vizidrixfork/Peershares,TheoremCrypto/TheoremCoin,CoinGame/NuShadowNet,thodg/ppcoin,valorbit/valorbit,etercoin/etercoin,yacoin/yacoin,IOCoin/DIONS,FuzzyBearBTC/Fuzzyshares,IOCoin/DIONS,nochowderforyou/clams,BeirdoMud/MudCoin,ppcoin/ppcoin,redfish64/nomiccoin,elcrypto/Pulse,valorbit/valorbit,etercoin/etercoin,Rimbit/Wallets,TheSeven/ppcoin,GeopaymeEE/e-goldcoin,gfneto/Peershares,nochowderforyou/clams,MOIN/moin,thunderrabbit/clams,neureal/noocoin,ghostlander/Orbitcoin,prodigal-son/blackcoin,etercoin/etercoin,blackcoinhelp/blackcoin,Peerunity/Peerunity,jyap808/jumbucks,redfish64/nomiccoin,senadj/yacoin,novacoin-project/novacoin,Kefkius/clams,d5000/ppcoin,ForceMajeure/BitPenny-Client,vizidrixfork/Peershares,penek/novacoin,Peershares/Peershares,FuzzyBearBTC/peercoin,IOCoin/iocoin,FuzzyBearBTC/peercoin,gorgoy/novacoin,TurboStake/TurboStake,MOIN/moin,effectsToCause/vericoin,sigmike/peercoin,xranby/blackcoin,pinkmagicdev/SwagBucks,stamhe/novacoin,FuzzyBearBTC/Peershares-1,NeuCoin/neucoin,TurboStake/TurboStake,IOCoin/DIONS,Peerunity/Peerunity,daeMOn63/Peershares,jashandeep-sohi/ppcoin,Kefkius/clams,Kefkius/clams,glv2/peerunity,slimcoin-project/Slimcoin,internaut-me/ppcoin,CoinBlack/bitcoin,ALEXIUMCOIN/alexium,AquariusNetwork/ARCOv2,d5000/ppcoin,internaut-me/ppcoin,Peerapps/ppcoin,byncoin-project/byncoin,Rimbit/Wallets,IOCoin/DIONS,gfneto/Peershares,lentza/SuperTurboStake,TurboStake/TurboStake,ya4-old-c-coder/yacoin,jyap808/jumbucks,IOCoin/iocoin,SproutsEx/SproutsExtreme,CoinGame/NuShadowNet,FuzzyBearBTC/Peershares-1,Peershares/Peershares,thunderrabbit/clams,dooglus/clams,MoMoneyMonetarism/ppcoin,slimcoin-project/Slimcoin,okcashpro/okcash,phorensic/yacoin,lordsajan/erupee,CoinBlack/blackcoin,GeopaymeEE/e-goldcoin,Peerapps/ppcoin,lordsajan/erupee,ppcoin/ppcoin,palm12341/jnc,yacoin/yacoin,VsyncCrypto/Vsync,neureal/noocoin,Stakemaker/OMFGcoin,glv2/peerunity,ghostlander/Testcoin,redfish64/nomiccoin,robvanmieghem/clams,valorbit/valorbit,MOIN/moin,thunderrabbit/clams,peercoin/peercoin,shadowproject/shadow,iadix/iadixcoin,jyap808/jumbucks,IOCoin/DIONS,FuzzyBearBTC/Peershares2,senadj/yacoin,iadix/iadixcoin,daeMOn63/Peershares,BeirdoMud/MudCoin,vectorcoindev/Vector,palm12341/jnc,slimcoin-project/Slimcoin,Peerapps/ppcoin,Magicking/neucoin,Stakemaker/OMFGcoin,phorensic/yacoin,Peerapps/ppcoin,senadj/yacoin,fsb4000/novacoin,Someguy123/novafoil,ALEXIUMCOIN/alexium,Jheguy2/Mercury,lateminer/DopeCoinGold,dopecoin-dev/DopeCoinGold,elambert2014/novacoin,Ziftr/ppcoin,effectsToCause/vericoin,novacoin-project/novacoin,internaut-me/ppcoin,stronghands/stronghands,effectsToCause/vericoin,AquariusNetwork/ARCOv2,Someguy123/novafoil,Whitecoin-org/Whitecoin,thodg/ppcoin,valorbit/valorbit,iadix/iadixcoin,palm12341/jnc,greencoin-dev/GreenCoinV2,FuzzyBearBTC/Peershares,Ziftr/Peerunity,rat4/blackcoin,IOCoin/DIONS,jlay11/sharecoin,nochowderforyou/clams,redfish64/nomiccoin,sproutcoin/sprouts,TheoremCrypto/TheoremCoin,AquariusNetwork/ARCOv2,AquariusNetwork/ARCOv2,blackcoinhelp/blackcoin,stronghands/stronghands,effectsToCause/vericoin,rat4/blackcoin,CoinGame/NuShadowNet,d5000/ppcoin,xranby/blackcoin,stamhe/ppcoin,Rimbit/Wallets,BlueMeanie/PeerShares,ForceMajeure/BitPenny-Client,stamhe/novacoin,sproutcoin/sprouts,yacoin/yacoin,lentza/SuperTurboStake,shadowproject/shadow,FuzzyBearBTC/peercoin,penek/novacoin,som4paul/BolieC,lentza/SuperTurboStake,thodg/ppcoin,FuzzyBearBTC/Peerunity,gades/novacoin,ALEXIUMCOIN/alexium,stamhe/ppcoin,peerdb/cors,BeirdoMud/MudCoin,FuzzyBearBTC/Peershares,MoMoneyMonetarism/ppcoin,Crypto-Currency/BitBar,Kefkius/clams,coinkeeper/2015-06-22_18-45_peercoin,ghostlander/Testcoin,robvanmieghem/clams,yacoin/yacoin,shadowproject/shadow,CoinGame/BCEShadowNet,ppcoin/ppcoin,byncoin-project/byncoin,IOCoin/iocoin,DigitalPandacoin/pandacoin,ghostlander/Orbitcoin,pocopoco/yacoin,lateminer/DopeCoinGold,CoinGame/NuShadowNet,GeopaymeEE/e-goldcoin,FuzzyBearBTC/Peerunity,greencoin-dev/GreenCoinV2,ya4-old-c-coder/yacoin,ya4-old-c-coder/yacoin