Make DisconnectBlock fault-tolerant
Add checksums to undo data

This should be compatible with older code that didn't write checksums.
New database check routine

-checklevel gets a new meaning:
0: verify blocks can be read from disk (like before)
1: verify (contextless) block validity (like before)
2: verify undo files can be read and have good checksums
3: verify coin database is consistent with the last few blocks
   (close to level 6 before)
4: verify all validity rules of the last few blocks

Level 3 is the new default, as it's reasonably fast. As level 3 and
4 are implemented using an in-memory rollback of the database, they
are limited to as many blocks as possible without exceeding the
limits set by -dbcache. The default of -dbcache=25 allows for some
150-200 blocks to be rolled back.

In case an error is found, the application quits with a message
instructing the user to restart with -reindex. Better instructions,
and automatic recovery (when possible) or automatic reindexing are
left as future work.
Merge pull request #2145 from sipa/checkcoins

Coin database checks
small main.h cleanup (no code changes)

- removes some obsolete comments about CTransaction::FetchInputs(), a
  space and a few new-lines
Merge pull request #2169 from Diapolo/small_main_h_cleanup

small main.h cleanup (no code changes)
Add const versions of base_uint.end()/begin(), make size() const.
Add MurmurHash3 implementation to hash.h/add hash.cpp.
Add a CBloomFilter class for use as a transaction filter.
Bump PROTOCOL_VERSION for filter messages.
Add a filter field in CNode, add filterload+filteradd+filterclear
Replace RelayMessage with RelayTransaction.
Automatically add any matching outputs to a filter during matching.
Add a CBlock.GetBlockHeader
Add a CMerkleBlock to store merkle branches of filtered txes.
Add test cases for CMerkleBlock and CBloomFilter.
Relay CMerkleBlocks when asked for MSG_FILTERED_BLOCK
Let a node opt out of tx invs before we get a their bloom filter

Note that the default value for fRelayTxes is false, meaning we
now no longer relay tx inv messages before receiving the remote
peer's version message.
Add a nTweak to bloom filters to tweak the seed.
Add CPartialMerkleTree

This adds a compact representation for a subset of a merkle tree's
nodes.