Allow mining RPCs with --disable-wallet

The following mining-related RPC calls don't use the wallet:

- getnetworkhashps
- getmininginfo
- getblocktemplate
- submitblock

Enable them when compiling with --disable-wallet.
Move internal miner functionality together