Reserve only one network specific cached path per session
Remove CBaseChainParams::NetworkID()
SQUASHME: NetworkIdFromCommandLine() function instead of method
SQUASHME: fix "Reserve only one network specific cached path per session"
Headers-first synchronization

Many changes:
* Do not use 'getblocks', but 'getheaders', and use it to build a headers tree.
* Blocks are fetched in parallel from all available outbound peers, using a
  limited moving window. When one peer stalls the movement of the window, it is
  disconnected.
* No more orphan blocks. At all. We only ever request a block for which we have
  verified the headers, and store it to disk immediately. This means that a
  disk-fill attack would require PoW.
* Require protocol version 31800 for every peer (released in december 2010).
* No more syncnode (we sync from everyone we can, though limited to 1 during
  initial *headers* sync).
* Introduce some extra named constants, comments and asserts.
RPC additions after headers-first
Remove CheckMinWork, as we always know all parent headers
Improve getheaders (sending) logging
Better logging of stalling
Add height to "Requesting block" debug
Rename setBlockIndexValid to setBlockIndexCandidates
Make -reindex cope with out-of-order blocks

Remember out-of-order block headers along with disk positions. This is
likely the simplest and least-impact way to make -reindex work with
headers first.

Based on top of #4468.
Skip reindexed blocks individually

Instead of skipping to the last reindexed block in each file (which could
jump over processed out-of-order blocks), just skip each already processed
block individually.
Fix rebuild-chainstate feature and improve its performance

Previous refactorings broke the ability to rebuild the chainstate by deleting the chainstate
directory, resulting in an incorrect "Incorrect or no genesis block found" error message. Fix
that.

Also, improve the performance of ActivateBestBlockStep by using the skiplist to only discover
a few potential blocks to connect at a time, instead of all blocks forever - as we likely bail
out after connecting a single one anyway.
Fix large reorgs
Add LIBTOOLFLAGS CXX tag to qt makefile include

Related #4993
squashme on 3fdb9e8c (Bluematt's bikeshedding)
Merge pull request #5096

e8ea0fd MOVEONLY: CInPoint from core to txmempool (jtimon)
Merge pull request #4804 from jtimon/chainparams3

Remove CBaseChainParams::NetworkID()
Merge pull request #5092

6f155bd Add LIBTOOLFLAGS CXX tag to qt makefile include (Michael Ford)