Do not use the redundant BestInvalidWork record in the block database.

As block index entries have a flag for marking invalid blocks, the
'best invalid work' information can be derived from there. In addition,
remove the global from main.h
Make some globals in main non-public.

This means they are declared static, and their extern definition in
main.h is removed. Also moved CBlockIndexWorkComparator to the .cpp
file.
Merge pull request #3087

caca6aa Make some globals in main non-public. (Pieter Wuille)
85eb2ce Do not use the redundant BestInvalidWork record in the block database. (Pieter Wuille)
.gitignore: Simplify references to the same file in different directories

Unless a .gitignore pattern is anchored, it'll match in any directory, not juts at the top level.  Simplify .gitignore accordingly.
Merge pull request #3193 from joshtriplett/patch-1

.gitignore: Simplify references to the same file in different directories