From 1d42efafaddf7d8550257e839105a91a12f1fd83 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Thu, 17 Oct 2013 11:16:45 -0400 Subject: [PATCH] Fix erroneous OpenWallet comment. The notification ID for new transactions to a watched address comment is unneeded, as OpenWallet does not attempt to track wallets against a connected btcd instance. Added an additional comment to the function noting this. A log.Debugf was also added so tracked addresses are shown in the debug output. --- cmd.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd.go b/cmd.go index 5e21c85..97459f2 100644 --- a/cmd.go +++ b/cmd.go @@ -134,6 +134,9 @@ func walletdir(cfg *config, account string) string { // OpenWallet opens a wallet described by account in the data // directory specified by cfg. If the wallet does not exist, ErrNoWallet // is returned as an error. +// +// Wallets opened from this function are not set to track against a +// btcd connection. func OpenWallet(cfg *config, account string) (*BtcWallet, error) { wdir := walletdir(cfg, account) fi, err := os.Stat(wdir) @@ -203,7 +206,6 @@ func OpenWallet(cfg *config, account string) (*BtcWallet, error) { w := &BtcWallet{ Wallet: wlt, name: account, - //NewBlockTxSeqN: // TODO(jrick): this MUST be set or notifications will be lost. } w.UtxoStore.s = utxos w.TxStore.s = txs @@ -294,7 +296,7 @@ func (w *BtcWallet) Track() { replyHandlers.m[n] = w.newBlockTxHandler replyHandlers.Unlock() for _, addr := range w.GetActiveAddresses() { - go w.ReqNewTxsForAddress(addr) + w.ReqNewTxsForAddress(addr) } } @@ -339,6 +341,8 @@ func (w *BtcWallet) RescanForAddress(addr string, blocks ...int) { // ReqNewTxsForAddress sends a message to btcd to request tx updates // for addr for each new block that is added to the blockchain. func (w *BtcWallet) ReqNewTxsForAddress(addr string) { + log.Debugf("Requesting notifications of TXs sending to address %v", addr) + w.mtx.RLock() n := w.NewBlockTxSeqN w.mtx.RUnlock()