Use rescan for initial tx notification registrations.

Requires btcsuite/btcd#310.
This commit is contained in:
Josh Rickmar 2015-02-19 15:04:14 -05:00
parent d9e2443002
commit dcf64e2957
2 changed files with 0 additions and 46 deletions

View file

@ -209,7 +209,6 @@ out:
addrs := msg.Addresses
noun := pickNoun(len(addrs), "address", "addresses")
if msg.WasInitialSync {
w.Track()
w.ResendUnminedTxs()
bs := keystore.BlockStamp{

View file

@ -1160,34 +1160,6 @@ func (w *Wallet) LockedOutpoints() []btcjson.TransactionInput {
return locked
}
// Track requests btcd to send notifications of new transactions for
// each address stored in a wallet.
func (w *Wallet) Track() {
// Request notifications for transactions sending to all wallet
// addresses.
//
// TODO: return as slice? (doesn't have to be ordered, or
// SortedActiveAddresses would be fine.)
addrMap := w.KeyStore.ActiveAddresses()
addrs := make([]btcutil.Address, len(addrMap))
i := 0
for addr := range addrMap {
addrs[i] = addr
i++
}
if err := w.chainSvr.NotifyReceived(addrs); err != nil {
log.Error("Unable to request transaction updates for address.")
}
unspent, err := w.TxStore.UnspentOutputs()
if err != nil {
log.Errorf("Unable to access unspent outputs: %v", err)
return
}
w.ReqSpentUtxoNtfns(unspent)
}
// ResendUnminedTxs iterates through all transactions that spend from wallet
// credits that are not known to have been mined into a block, and attempts
// to send each to the chain server for relay.
@ -1318,23 +1290,6 @@ func (w *Wallet) RecoverAddresses(n int) error {
return nil
}
// ReqSpentUtxoNtfns sends a message to btcd to request updates for when
// a stored UTXO has been spent.
func (w *Wallet) ReqSpentUtxoNtfns(credits []txstore.Credit) {
ops := make([]*wire.OutPoint, len(credits))
for i, c := range credits {
op := c.OutPoint()
log.Debugf("Requesting spent UTXO notifications for Outpoint "+
"hash %s index %d", op.Hash, op.Index)
ops[i] = op
}
if err := w.chainSvr.NotifySpent(ops); err != nil {
log.Errorf("Cannot request notifications for spent outputs: %v",
err)
}
}
// TotalReceived iterates through a wallet's transaction history, returning the
// total amount of bitcoins received for any wallet address. Amounts received
// through multisig transactions are ignored.