This variable should be in CWallet, IMHO; certainly not a global in main.

Actually, why is this variable even necessary at all? Have CWallet::TopupKeyPool take an int size as argument, and pass GetArg("-keypool") to it, or where necessary an overridable value.