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.
Ok.  Yes, it is always the length - I included it originally for convenience when reading the data manually in a terminal or something.  But I can remove it, as it is indeed redundant.  I realise there are in general a lot of rough edges in the patch, I'll update it tomorrow to a hopefully cleaner one.