Update chain state with best block.

Rather than updating the new chain state with the hash and height of the
block that was just processed, query the database for the best block.
This is needed because the block that was just processed might be a side
chain block or have caused a reorg.
Add new logging subsystem for mining related ops.

This commit adds a new logging subsystem named MINR which is used for
logging mining releated operations.
Add options to control block creation settings.

This commit adds three new options which are intended to to be used by the
upcoming mining-related block template creation code.
Add infrastructure for creating a block template.

This commit adds a new function named NewBlockTemplate along with
supporting infrastructure which is part of the core functionality needed
to support mining.

In particular the function creates a new block template which contains a
fully populated block with a zero nonce that is ready to be solved as well
as additional information regarding the fees and number of signature
operations for each transaction included in the block.  The specific
transaction selection logic mirrors the reference implementation.

Various cleanup and suggestions provided by @owainga.
Update for recent change to block manager FIFO.
Optimize calcPriority.

Suggested by @owainga.
Be specific about 1000 bytes for KB in relay fees.
Rename inputPriority to inputValueAge.

This is intended to make the distinction between a priority and the sum of
the the input values multiplied by their respective ages a little more
clear.

Suggested by @flammit.
Fix comment typo for kilobyte.
Update to ensure template is after median time.

Also, convert to use new chain state.
Comment updates from @owainga.