Use btcjson.ErrWallet for createencryptedwallet.

If an unexpected error is encounted when creating the encrypted
wallet, rather than using btcjson.ErrInternal, wrap the error message
using btcjson.ErrWallet.Code.
Prevent full handshake rescans on btcd reconnect.

If a rescan fails (for example, due to a disconnected btcd) in the
btcd handshake, the last block height from a rescanprogress
notification should be used for the next rescan job on next wallet
connect.  Previously, this rescan would always start at the earliest
block height for any wallet address if the transaction store could not
be read at wallet startup.  This change unsets the boolean flag which
would cause a full rescan at next connect when a rescan progress
notification is received and a partial sync height is written.

Fixes #87.
No full rescans after rescan completion.

If the rescan finishes before any progress notifications have been
received, also unset the need to perform a full rescan next btcd
reconnect.
go fmt.
Fix rescans across wallet process restarts.

This change immediately writes a new empty transaction store out to
disk if the old one could not be read.  Since old transaction store
versions are not read in at start, and were previously not written out
until new transaction history was received, it was possible that a
full rescan started and finished without ever marking a synced tx
history for the next wallet start.
Use t.Errorf for test formatting directives.
Remove closure over a range iterator.
Do not error opening simnet wallets.
Fix typo.
Avoid slice out-of-bounds indexing panic.

The gettransaction handler was attempting to lookup the "sent-to"
address of an outgoing transaction from the transaction store (as a
wallet credit).  This is the incorrect address when sending to an
address controlled by another wallet, and panics when there are no
credits (for example, sending to another wallet without any change
address).  Instead, use the first non-change output address is used as
the address of the "send" result.

This fixes the panic reported when debugging issue #91.

While here, fix the category strings used for wallet credits to
support immature and generate (the categories for coinbase outputs).
Handle unopenable transaction stores.

If the transaction store cannot be opened and read (i.e. the version
is too old to be deserialized), the wallet is marked unsynced and
rewritten, and a new empty transaction store is written over the
previous.
Fix and simplify RPC server error handling.

This change rewrites much of the error handling for the RPC server
components to match a more idiomatic Go error handling style as well as
fix several issues regarding error equality checks.

Closes #94.
Consistantly create empty bytes.Buffers.