AvailableCoins: acquire cs_main mutex

It's required when called from WalletModel
Merge pull request #4371

ea3acaf AvailableCoins: acquire cs_main mutex (Pavel Vasin)
small cleanup in src/compat .h and .cpp

- add license header
- fix include guards
- fix indentation
Allocate receive buffers in on the fly
Add nLocalServices info to RPC getinfo

Also show full 64 bits of services. Previously service bits >32 that
were advertised just didn't show up at all.
Add comment regarding experimental-use service bits

As per mailing list discussion.
Merge pull request #4380

38405ac Add comment regarding experimental-use service bits (Peter Todd)
99ddc6c Add nLocalServices info to RPC getinfo (Peter Todd)
Add a built-in SHA256/SHA512 implementation.

This also moves the HMAC-SHA512 implementation to sha2.cpp.
Switch script.cpp and hash.cpp to use sha2.cpp instead of OpenSSL.
Remove getwork() RPC call
Switch miner.cpp to use sha2 instead of OpenSSL.
Add built-in SHA-1 implementation.
Move crypto implementations to src/crypto/
Add built-in RIPEMD-160 implementation
Move {Read,Write}{LE,BE}{32,64} to common.h and use builtins if possible
Extend and move all crypto tests to crypto_tests.cpp
build: move bitcoin-config.h to its own directory

This allows us to include its path without making other header includes valid.
crypto: explicitly check for byte read/write functions

Don't depend on hard-coded platform lists
crypto: create a separate lib for crypto functions

This lib has no dependencies on other bitcoin functionality. Attempting to
use bitcoin headers will result in a failure to compile.
Add <Hasher>::OUTPUT_SIZE