Move CBlockIndex, CChain and related code out of main