Commit graph

11 commits

Author SHA1 Message Date
Josh Rickmar
413f23ea18 Add support for listtransactions RPC request.
This change adds support for the listtransactions RPC command.  To
properly reply to this command, additonal information about received
transactions was added, and is now saved in an account's tx.bin file.
Additionally, when sending a transaction, a *tx.SendTx is now saved to
the Tx store, and is included in listtransactions replies under the
"send" category.

WARNING: All account's tx.bin and utxo.bin files should be removed
before running with this change, or else the files may not be read
correctly.  Removing tx.bin is not an issue as it was not being used
before, and was being saved with incorrect data.  Removing utxo.bin is
not an issue as it will just trigger a rescan on next start.  File
format versions are now included in both files, so automatic updates
from previous file formats will be possible with future changes.

Fixes #12.
2013-11-26 16:22:15 -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
a12eb62b4d Make tests build again. 2013-10-22 10:03:11 -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
Josh Rickmar
fa85e586fc Save the pkScript for each Utxo. This is needed to create transactions. 2013-09-09 13:31:37 -04:00
Josh Rickmar
a6ad4cf48c Save index as well as tx hash for outputs. 2013-09-04 16:16:20 -04:00
Josh Rickmar
0928361f22 Save address with Utxo.
We want only one utxo file per wallet, so each serialized Utxo needs
to also contain the receiving address.
2013-09-04 09:32:14 -04:00
Josh Rickmar
d89cdaca08 go fmt 2013-08-26 13:35:29 -04:00
Josh Rickmar
7716ad7e38 Tests for RecvTx, SendTx, and TxStore 2013-08-26 13:34:18 -04:00
Josh Rickmar
a080d13f1c go fmt 2013-08-26 10:52:57 -04:00
Josh Rickmar
347b15ba3a Add ReadFrom and WriteTo tests for Utxo and UtxoStore 2013-08-26 10:48:42 -04:00