Move CBlockIndex, CChain and related code out of main

After these changes main.h has only 603 lines, and main.cpp only 4344 lines.
One step at a time...