We need to notify frontends of notifications for every account
(wallet), not just the "current" opened account, since wallet will
need to have multiple wallets open at the same time. Frontends will
have to filter notifications to show only details of only one account
if they need to display just one account at a time.
As of this commit, account balances and lock state notifications are
using this per-account notification scheme.
This is a big change that also many general fixes to problems found
when creating transactions. In particular the Utxo and Tx formats and
serialization functions were updated with additional information that
would be necessary for rolling back old utxo and tx data data after
btcd chain switches. This change also implements the json methods
'sendfrom' and 'sendmany' to create a new transaction based on a
frontend request.
Transactions are currently not sent to btcd since the tx relay code is
not finished yet, so a temporary error is returned back to frontends
who try to send new transactions.
btcd now has only one notifier mechanism for received transactions to
a watched address. This previously combines the seperate notifiers
for generic tx and exclusively unspent outputs.
A new handler will be added to watch for spent outputs instead of
relying on the now-removed "btcd:sendtx" notification.
Each wallet needs its own handler running and listening to replies
from btcd, so that wallet can be synced to disk with the new tx or
utxo information. Another rounter to map from addresses to wallets
could have been written, but we'll use the JSON Id router message
router instead.
We must instead wait for the user to explicitly generate their own
wallet for an account name. This is because all btcwallet wallets
must be encrypted, and the passphrase must be known at time of wallet
generation.