remove duplicate bitdb.Open() code from init

- remove code from step 7, which we already have in step 5 of init
Try moving database/ away in case of failure
Remove database/ after clean shutdown
Allow the default key to be unavailable

This solves the issue where no default key can be added after -salvagewallet.
Improve gettxoutsetinfo command

* Bugfix: output the correct best block hash (during IBD, it can
  differ from the actual current best block)
* Add height to output
* Add hash_serialized, which is a hash of the entire UTXO state.
  Can be useful to compare two nodes.
* Add total_amount, the sum of all UTXOs' values.
Bugfix: if no bestblock record is present, do a -rescan

It is possible to have a wallet.dat file without any bestblock
record at all (if created offline, for example), which - when
loaded into a client with a up-to-date chain - does no rescan and
shows no transactions.

Also make sure to write the current best block after a rescan, so
it isn't necessary twice.
Do not kill connections on recv buffer overflow

Instead of killing a connection when the receive buffer overflows,
just temporarily halt receiving before that happens. Also, no
matter what, always allow at least one full message in the receive
buffer (otherwise blocks larger than the configured buffer size
would pause indefinitely).
Exit cleanly if AppInit2 returns false

Bitcoin-Qt could core dump if application initialization failed in certain ways.

I double-fixed this:
1) qt/bitcoin.cpp now shuts down core threads cleanly if AppInit2 returns false
2) init.cpp now exits before StartNode() if strErrors is set (no reason to StartNode if we're just going to exit immediately anyway).

Tested by triggering all of the various ways AppInit2 can fail, either by passing bogus command-line arguments or just recompiling tweaked code to simulate failure.

This is a partial fix for #2480
Do not write to wallet during LoadWallet

When debugging another issue, I found a hang-during-startup race condition due to
LoadWallet calling SetMinVersion (via LoadCryptedKey).

Writing to the file that you're in the process of reading is a bad idea.
clear path cache after getting a proper config file (fixes #2605)

Signed-off-by: Jonas Schnelli <jonas.schnelli@include7.ch>
Remove implementation of disabled opcodes

So we stop getting pull requests (like #2604) fixing problems with disabled Script opcodes.
A hard fork would be required to re-enable these, and if we ever did that we'd require extensive review and testing.
Merge pull request #2608 from jonasschnelli/pathCacheFix

clear path cache after getting a proper config file (fixes #2605)
osx: show testnet icon in dock as early as possible

A green testnet splashscreen with a normal, orange dock icon looks strange and can confuse users.

Signed-off-by: Jonas Schnelli <jonas.schnelli@include7.ch>
Remove flaky util thread unit tests
Define dust transaction outputs, and make them non-standard
CreateTransaction: return strFailReason on failure
Un-hardcode TX_FEE constants

Allow setting of MIN_TX_FEE / MIN_RELAY_TX_FEE with
-mintxfee / -mintxrelayfee

Default values are the same (0.0001 BTC).
small init.cpp changes (strings / Winsock init)

- add a check that requested Winsock version is available
- update some strings
- remove -gen=0 from help-message as this is default
Merge pull request #2598 from Diapolo/init

small init.cpp changes (strings / Winsock init)
Merge pull request #2602 from sipa/utxostate

Improve gettxoutsetinfo command