Use rescan for initial tx notification registrations.
Requires btcsuite/btcd#310.
This commit is contained in:
parent
d9e2443002
commit
dcf64e2957
2 changed files with 0 additions and 46 deletions
|
@ -209,7 +209,6 @@ out:
|
||||||
addrs := msg.Addresses
|
addrs := msg.Addresses
|
||||||
noun := pickNoun(len(addrs), "address", "addresses")
|
noun := pickNoun(len(addrs), "address", "addresses")
|
||||||
if msg.WasInitialSync {
|
if msg.WasInitialSync {
|
||||||
w.Track()
|
|
||||||
w.ResendUnminedTxs()
|
w.ResendUnminedTxs()
|
||||||
|
|
||||||
bs := keystore.BlockStamp{
|
bs := keystore.BlockStamp{
|
||||||
|
|
45
wallet.go
45
wallet.go
|
@ -1160,34 +1160,6 @@ func (w *Wallet) LockedOutpoints() []btcjson.TransactionInput {
|
||||||
return locked
|
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
|
// ResendUnminedTxs iterates through all transactions that spend from wallet
|
||||||
// credits that are not known to have been mined into a block, and attempts
|
// credits that are not known to have been mined into a block, and attempts
|
||||||
// to send each to the chain server for relay.
|
// to send each to the chain server for relay.
|
||||||
|
@ -1318,23 +1290,6 @@ func (w *Wallet) RecoverAddresses(n int) error {
|
||||||
return nil
|
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
|
// TotalReceived iterates through a wallet's transaction history, returning the
|
||||||
// total amount of bitcoins received for any wallet address. Amounts received
|
// total amount of bitcoins received for any wallet address. Amounts received
|
||||||
// through multisig transactions are ignored.
|
// through multisig transactions are ignored.
|
||||||
|
|
Loading…
Reference in a new issue