Commit graph

10 commits

Author SHA1 Message Date
Josh Rickmar
b1c246c01b Perform smarter UTXO tracking.
This change fixes many issues with the tracking of unspent transaction
outputs.  First, notifications for when UTXOs arse spent are now
requested from btcd, and when spent, will be removed from the
UtxoStore.

Second, when transactions are created, the unconfirmed (not yet in a
block) Utxo (with block height -1 and zeroed block hash) is added to
the wallet's UtxoStore.  Notifications for when this UTXO is spent are
also requested from btcd.  After the tx appears in a block, because
the UTXO has a pkScript to be spent by another owned wallet address, a
notification with the UTXO will be sent to btcwallet.  We already
store the unconfirmed UTXO, so at this point the actual block height
and hash are filled in.

Finally, when calculating the balance, if confirmations is zero,
unconfirmed UTXOs (block height -1) will be included in the balance.
Otherwise, they are ignored.
2013-10-22 09:55:53 -04:00
Josh Rickmar
51cb34e50a Add func to remove utxos from a UtxoStore. 2013-10-15 10:05:51 -04:00
Josh Rickmar
50073b32c1 Save correct addresses for new utxos 2013-10-10 18:44:44 -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
ab623ec9e0 Read and write tx fee from SendTxs 2013-08-27 12:39:45 -04:00
Josh Rickmar
7716ad7e38 Tests for RecvTx, SendTx, and TxStore 2013-08-26 13:34:18 -04:00
Josh Rickmar
e80d089a15 Implement io.ReaderFrom and io.WriterTo tx/utxo types.
These are currently untested.
2013-08-23 14:28:07 -04:00