Implement "getchains" RPC command to monitor blockchain forks.

Port over https://github.com/chronokings/huntercoin/pull/19 from
Huntercoin:  This implements a new RPC command "getchains" that can be
used to find all currently active chain heads.  This is similar to the
-printblocktree startup option, but it can be used without restarting
just via the RPC interface on a running daemon.
The name 'isbest' may be obvious now, but if #4468 would get merged, we may end up with multiple header tips that all descend from the current chainActive (while we're catching up).

I'm not sure how to deal with this, but something branchlen essentially conveys this information already (maybe a better name is 'reorg_distance' or 'fork_distance', or replace it with 'fork_height'?) - if it's 0, it extends our main branch.