Include undo data to startup checks and refactor them onto a function.

The check is now simpler, somewhat more efficient, and
covers more data, to be sure the node can reorganize.
Add a switch to allow the node to run on a pruned state

These are the main functional changes on this state:

* The node is prevented to run with a wallet.
* Check for data at startup is limited to last 288 blocks.
* NODE_NETWORK flag is unset.
* Requests for pruned blocks from other peers are ignored.