b1c246c01b
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. |
||
---|---|---|
.. | ||
tx.go | ||
tx_test.go |