There are certain RPCs where an address should be sent as the raw string
instead of the encoded bitcoin address since the RPC handler on the other
end expects "keys" instead of Bitcoin addresses.
For example, the multisignature RPCs addmultisigaddress and createmultisig
can work with pubkeys (compressed, uncompressed, or hybrid) as well as
Bitcoin addresses.
The original issue which prompted these changes was report by Paul Snow on
IRC.
Rather than using bytes.NewBuffer, which is a read/write entity
(io.ReadWriter), use bytes.NewReader which is only a read entitiy
(io.Reader). Benchmarking shows it's slightly faster and it's also
technically more accurate since it ensures the data is read-only.
The btcutil package recently exposed a WIF type to provide more
functionality and simplify working with WIF strings. This commit changes
the DumpPrivKey and ImportPrivKey RPCs to use the new WIF type.
There are several RPCs which accept a pointer to a hash, transaction,
block, etc. Previously not all RPCs handled being passed a nil pointer
consistently.
Closes#4.
This commit adds logic to track all registered notifications that have
been registered by the client in a notification state when the default
automatic reconnect is enabled.
The notification state is then used to reregister for all previously
registered notifications on reconnect. This allows the caller to
continue receiving notifications across reconnect cycles.
Also, since the new package exposes more connection related error
information, add a new ErrInvalidEndpoint which is returned if the
specified enpoint does not appear to be a valid websocket provider and
only return the ErrInvalidAuth error when HTTP authorization failure
status codes are detected.
Closes#1.
Since the example illustrates callbacks for the OnBlockConnected and
OnBlockDisconnected callbacks, also register for the notifications with
NotifyBlocks.
While here, document the fact that most of the callbacks require
registration.