Implement basic getblocktemplate BIP0022 support.

This commit implements the non-optional and template tweaking support for
the getblocktemplate RPC as defined by BIP0022.  This implementation does
not yet include long polling support.

This is work towards #124.
Implement getblocktemplate long poll support.

This commit implements the long polling portion of the getblocktemplate
RPC as defined by BIP0022.  Per the specification, each block template is
returned with a longpollid which can be used in a subsequent
getblocktemplate request to keep the connection open until the server
determines the block template associated with the longpollid should be
replaced with a new one.

This is work towards #124.
Implement BIP0023 basic pool extensions support.

This commit implements the basic pool extension portion of the getblocktemplate
RPC as defined by BIP0023.

This is work towards #124.
Implement BIP0023 getblocktemplate block proposals.

This commit implements block proposals as defined by BIP0023.

This is work towards #124.
Implement some BIP0023 getblocktemplate mutations.

This commit implements a portion of the mutations section of BIP0023.
In particular, it adds the mutable, mintime, maxtime, and noncerange keys
to the returned block template along with indicating support for the time,
transactions/add, prevblock, and coinbase/append mutations.  Also, the
addition of the mintime and maxtime fields imply support for the
time/decrement and time/increment mutations.  Further, if the caller
indicates the coinbasevalue capability, the coinbasetxn field will be
omitted thereby implying support for the coinbase and generation
mutations.

Closes #124.
Seed random generator in RPC server during init.

Rather than reseeding the PRNG used throughout the RPC server on each
call, do it once during init.

Suggested by @jrick
Address a few more comments.
each goroutine needs its own random source.

caught by the race detector.
organize.

no objections from @davecgh
Put mutexes in exported functions.
We only care about the peers.json file...
Correct pushGetMerkleBlock throttling.

This commit corrects the check which sends in the done channel when
pushing merkle blocks that have no transactions to go with them.
Remove outdated comment.
Use chan struct{} for tx/blockProcessed chans.

These channels are being used as semaphores, so it's more efficient to use
a 0-byte type and allow compiler optimizations for the specific use case.
Use chan struct{} for throttling related chans.

The done and wait channels used to throttle outgoing data are being used
as semaphores.  As mentioned in the previous commit, it's more efficient
to use a 0-byte type and allow compiler optimizations for the specific use
case.
Update to account for recent btcchain API changes.
Fix off-by-one making rescanfinished notification.

Fixes #150.

ok @davecgh
Log accepted blocks via submitblock.

ok @davecgh
Implement BIP0061 reject handling (pver 70002).

This commit implements reject handling as defined by BIP0061 and bumps the
maximum supported protocol version to 70002 accordingly.

As a part of supporting this a new error type named RuleError has been
introduced which encapsulates and underlying error which could be one of
the existing TxRuleError or btcchain.RuleError types.

This allows a single high level type assertion to be used to determine if
the block or transaction was rejected due to a rule error or due to an
unexpected error.  Meanwhile, an appropriate reject error can be created
from the error by pulling the underlying error out and using it.

Also, a check for minimum protocol version of 209 has been added.

Closes #133.
Only show parse errors and command to invoke usage.

Rather than showing the usage when an error is encounted during options
parsing, show a message that describes how to invoke help instead.  This
is useful because the help is long enough now that the error is often
overlooked since it scrolls out of view.

ok @jrick