Commit graph

15 commits

Author SHA1 Message Date
Josh Rickmar
6a08c7de07 Redo account locking and RPC request processing.
This change removes the three separate mutexes which used to lock an
account's wallet, tx store, and utxo store.  Accounts no longer
contain any locking mechanism and rely on go's other synchronization
constructs (goroutines and channels) for correct access.

All accounts are now managed as a collection through the new
AccountManager, rather than the old AccountStore.  AccountManager runs
as its own goroutine to provide access to accounts.

RPC requests are now queued for handling, being denied if the queue
buffer is exhausted.  Notifications are also queued (instead of being
sent from their own goroutine after being received, in which order is
undefined), however, notifications are never dropped and will
potentially grow a queue of infinite size if unhandled.
2014-02-01 13:18:34 -05:00
Josh Rickmar
be4c549682 Tests build again. 2014-01-16 12:04:47 -05:00
Josh Rickmar
e8265eca41 Switch to new btcutil Address encoding/decoding API. 2014-01-06 12:24:29 -05:00
Josh Rickmar
48a685e85e Calculate the minimum tx fee when creating transactions. 2013-12-04 12:13:40 -05:00
Josh Rickmar
a05e9b7a3e Make tests pass again. 2013-11-22 11:40:24 -05:00
David Hill
37109bfe0d update tests to use the new Account type and catch rand.Read errors 2013-11-15 12:03:52 -05:00
Josh Rickmar
437772fcb1 Fix tests. 2013-11-12 12:08:10 -05:00
Josh Rickmar
18fb993d0b Implement address rescanning.
When a wallet is opened, a rescan request will be sent to btcd with
all active addresses from the wallet, to rescan from the last synced
block (now saved to the wallet file) and the current best block.

As multi-account support is further explored, rescan requests should
be batched together to send a single request for all addresses from
all wallets.

This change introduces several changes to the wallet, tx, and utxo
files.  Wallet files are still compatible, however, a rescan will try
to start at the genesis block since no correct "last synced to" or
"created at block X" was saved.  The tx and utxo files, however, are
not compatible and should be deleted (or an error will occur on read).
If any errors occur opening the utxo file, a rescan will start
beginning at the creation block saved in the wallet.
2013-11-01 10:06:38 -04:00
Josh Rickmar
851a9d6e41 Simplify txToPairs function signature.
This moves the non-error return values for txToPairs into a new
struct, createdTx, and adds an additional value for the payment
address string.
2013-10-28 11:24:50 -04:00
Josh Rickmar
a12eb62b4d Make tests build again. 2013-10-22 10:03:11 -04:00
Josh Rickmar
d44159b452 Fix issues found by golint and go vet. 2013-10-14 16:39:15 -04:00
Josh Rickmar
97a942e499 fix tests 2013-10-13 19:25:47 -04:00
Josh Rickmar
b137542c92 unbreak tests 2013-10-07 14:26:29 -04:00
Josh Rickmar
0f986d6cf3 More test code 2013-10-04 12:05:16 -04:00
Josh Rickmar
63686347c6 Create transactions using saved utxo data.
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.
2013-10-01 14:26:27 -04:00