qt: add vout index to transaction id in transactions details dialog

Conflicts:
	src/qt/transactiondesc.cpp

Conflicts:
	src/qt/transactiondesc.cpp
	src/qt/transactiondesc.h
	src/qt/transactionrecord.cpp
	src/qt/transactiontablemodel.cpp
[Qt] Fix Transaction details shows wrong To:

Conflicts:
	src/qt/transactiondesc.cpp
AddToBlockIndex() is always called with locked cs_main
Replace non-threadsafe gmtime and setlocale

Make DateTimeStrFormat use boost::posix_time.

Also re-enable the util_DateTimeStrFormat tests, as they are no
longer platform specific.

Conflicts:
	src/test/util_tests.cpp
	src/util.cpp

Conflicts:
	src/rpcprotocol.cpp
	src/util.cpp
error if CheckProofOfStake() failed
Refactor: CTxMempool class to its own txmempool.{cpp,h}

Conflicts:
	src/init.cpp
	src/main.cpp
remove peercoin sync hacks
Make sure we always have a node to do IBD from

This introduces the concept of the 'sync node', which is the one we
asked for missing blocks. In case the sync node goes away, a new one
will be selected.

For now, the heuristic is very simple, but it can easily be extended
later to add better policies.

Conflicts:
	src/main.cpp
	src/net.cpp

Conflicts:
	src/main.cpp
Add bytessent, bytesrecv and syncnode to getpeerinfo

Conflicts:
	src/net.cpp
	src/net.h
	src/rpcnet.cpp
always show syncnode in getpeerinfo (fixes #2717)

Conflicts:
	src/rpcnet.cpp
Use pnode->nLastRecv as sync score directly

NodeSyncScore() should find the node which we recv data most recently, so put a negative sign to pnode->nLastRecv is indeed wrong.

Also change the return value type to int64_t.

Signed-off-by: Huang Le <4tarhl@gmail.com>
Add RPC command 'getstakedbyaddress' to find out how much an address has earned from staking.
Tidying up.
Add optional 'minconf' argument to 'getstakedbyaddress' RPC call.