Check for canonical public keys and signatures

Only enabled inside tests for now.
P2P: Do not request blocks from peers with fewer blocks than us

If the remote node has a shorter chain, do not waste our
special getblocks request on them.
Send 'mempool' P2P command at the start of each P2P session
to query remote node mempool contents.
move most explicit getters in optionsmodel to header

- is more consistent and saves quite some lines of code
remove "checkorder" and "reply" P2P commands

These command are a leftover from send-to-IP transactions, which have been
removed a long time ago.
Also removes CNode::mapRequests and CNode::PushRequests, as these were
only used for the mentioned commands.
Avoid crashes at shutdown due to printf() in global destructors.
fix wrong (signed/unsigned) printf format specifier in bitcoinrpc.cpp

- also includes the required bitcoinstrings.cpp update
get rid of strlcpy.h

Don't use hand-rolled string manipulation routine with a fixed
buffer in the bitcoin core, instead make use of c++ strings and boost.
Remove I2P support from netbase

I2P apparently needs 256 bits to store a fully routable address. Garlicat
requires a centralized lookup service to map the 80-bit addresses to fully
routable ones (as far as I understood), so that's not really usable in our
situation.

To support I2P routing and peer exchange for it, another solution is needed.
This will most likely imply a network protocol change, and extension of the
'addr' message.
Use fdatasync instead of fsync on supported platforms
make optionsmodel query real proxy state for ::data()

- don't rely on the QSettings for cases ProxyUse and ProxySocksVersion and
  query the real values via the GetProxy() call
- add a missing "succesful =" for case ProxyUse in ::setData()
change Q_WS_MAC -> Q_OS_MAC (Qt5 compatibility)

- I missed that one in my former pull
CAddrMan: verify pchMessageStart file marker, before reading address data

This avoids the case where you read the address data, before noticing it is
the wrong network.
Handle incompatible BDB environments

Before, opening a -datadir that was created with a new
version of Berkeley DB would result in an un-caught DB_RUNRECOVERY
exception.

After these changes, the error is caught and the user is told
that there is a problem and is told how to try to recover from
it.
Merge branch 'BDB_DOWNGRADE'
Handle incompatible BDB environments

Before, opening a -datadir that was created with a new
version of Berkeley DB would result in an un-caught DB_RUNRECOVERY
exception.

After these changes, the error is caught and the user is told
that there is a problem and is told how to try to recover from
it.
Handle corrupt wallets gracefully.

Corrupt wallets used to cause a DB_RUNRECOVERY uncaught exception and a
crash. This commit does three things:

1) Runs a BDB verify early in the startup process, and if there is a
low-level problem with the database:
  + Moves the bad wallet.dat to wallet.timestamp.bak
  + Runs a 'salvage' operation to get key/value pairs, and
    writes them to a new wallet.dat
  + Continues with startup.

2) Much more tolerant of serialization errors. All errors in deserialization
are reported by tolerated EXCEPT for errors related to reading keypairs
or master key records-- those are reported and then shut down, so the user
can get help (or recover from a backup).

3) Adds a new -salvagewallet option, which:
 + Moves the wallet.dat to wallet.timestamp.bak
 + extracts ONLY keypairs and master keys into a new wallet.dat
 + soft-sets -rescan, to recreate transaction history

This was tested by randomly corrupting testnet wallets using a little
python script I wrote (https://gist.github.com/3812689)
Don't try to verify a non-existent wallet.dat
Merge pull request #1833 from jgarzik/mempool-query

Send 'mempool' P2P command at the start of each P2P session
Revert "Send 'mempool' P2P command at the start of each P2P session"

Fat-fingered on github, and merged this too early.

This reverts commit 22f9b069035c9ba0416a62714db167eea5ba762f.