Simplify and rename CheckWork to ProcessBlockFound
Reduce maximum coinscache size during verification

Due to growing coinsviewcaches, the memory usage with checklevel=3
(and standard settings for dbcache) could be up to 500MiB on a
64-bit system. This is about twice the peak during reindexing,
unnecessarily extending bitcoind's memory envelope.

This commit reduces the maximum total size of the caches used during
verification to just nCoinCacheSize, which should be the limit.
Merge pull request #4603

f0c2915 Simplify and rename CheckWork to ProcessBlockFound (jtimon)
Fix thread name setting

Because of a typo, thread names no longer appeared in the overview.

This was broken in 51ed9ec.
build: check for sys/prctl.h in the proper way

Use AC_CHECK_HEADERS to check for the header, and include it only
if detected and the subsequent HAVE_SYS_PRCTL_H is set.
qt: better looking trayicon

Github-Pull: #4678
Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
Merge pull request #4675

ea100c7 Reduce maximum coinscache size during verification (Wladimir J. van der Laan)
Split CCoinsView::GetCoins into GetCoins and ModifyCoins

Make intention more clear:

- Call ModifyCoins if you intend to change the coins
- Call GetCoins to get a const reference to the coins

This can be used for dirty tracking later on.
Implement CCoinsViewCache::GetCoins with FetchCoins

Avoids duplicating logic.
Also move the function together with its other overload in the
implementation file.
Make CCoinsViewCache::FetchCoins return a pointer instead of an iterator

This makes it possible to use different data structures for different
parts of the cache.
CCoinsViewCache: separate read and write caches

Keep track of entries that are read-only or r/w in separate
caches. This is an optimization that avoids writing back all
accessed entries back to the database on a flush.

Also makes the way clear for future optimizations such as putting a
fixed limit on the size of the read cache.
debugging
Add cache flags to CCoinsViewCache Flush and GetCacheSize

Make it possible to determine what caches to flush, and
to get the size of the read and write cache separately if desired.
Change WriteChainState to use cache flags

- Flush READ and WRITE caches if maximum size exceeded (`pcoinsTip->GetCacheSize() > nCoinCacheSize`)
- Flush WRITE cache periodically if !InitialBlockDownload()
Create a constant for chainstate write period in WriteChainState
Add coinscache information to RPC

Makes it possible to measure and compare caching strategies.
Accumulate statistics in CCoinsViewCache
Move entries from write to read cache on flush

There's a large chance that entries will be accessed again after
being written.
Cache negative hits
Change the read cache to a MRU cache