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.
This commit is contained in:
parent
44c5d29c3b
commit
1d42efafad
1 changed files with 6 additions and 2 deletions
8
cmd.go
8
cmd.go
|
@ -134,6 +134,9 @@ func walletdir(cfg *config, account string) string {
|
||||||
// OpenWallet opens a wallet described by account in the data
|
// OpenWallet opens a wallet described by account in the data
|
||||||
// directory specified by cfg. If the wallet does not exist, ErrNoWallet
|
// directory specified by cfg. If the wallet does not exist, ErrNoWallet
|
||||||
// is returned as an error.
|
// 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) {
|
func OpenWallet(cfg *config, account string) (*BtcWallet, error) {
|
||||||
wdir := walletdir(cfg, account)
|
wdir := walletdir(cfg, account)
|
||||||
fi, err := os.Stat(wdir)
|
fi, err := os.Stat(wdir)
|
||||||
|
@ -203,7 +206,6 @@ func OpenWallet(cfg *config, account string) (*BtcWallet, error) {
|
||||||
w := &BtcWallet{
|
w := &BtcWallet{
|
||||||
Wallet: wlt,
|
Wallet: wlt,
|
||||||
name: account,
|
name: account,
|
||||||
//NewBlockTxSeqN: // TODO(jrick): this MUST be set or notifications will be lost.
|
|
||||||
}
|
}
|
||||||
w.UtxoStore.s = utxos
|
w.UtxoStore.s = utxos
|
||||||
w.TxStore.s = txs
|
w.TxStore.s = txs
|
||||||
|
@ -294,7 +296,7 @@ func (w *BtcWallet) Track() {
|
||||||
replyHandlers.m[n] = w.newBlockTxHandler
|
replyHandlers.m[n] = w.newBlockTxHandler
|
||||||
replyHandlers.Unlock()
|
replyHandlers.Unlock()
|
||||||
for _, addr := range w.GetActiveAddresses() {
|
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
|
// ReqNewTxsForAddress sends a message to btcd to request tx updates
|
||||||
// for addr for each new block that is added to the blockchain.
|
// for addr for each new block that is added to the blockchain.
|
||||||
func (w *BtcWallet) ReqNewTxsForAddress(addr string) {
|
func (w *BtcWallet) ReqNewTxsForAddress(addr string) {
|
||||||
|
log.Debugf("Requesting notifications of TXs sending to address %v", addr)
|
||||||
|
|
||||||
w.mtx.RLock()
|
w.mtx.RLock()
|
||||||
n := w.NewBlockTxSeqN
|
n := w.NewBlockTxSeqN
|
||||||
w.mtx.RUnlock()
|
w.mtx.RUnlock()
|
||||||
|
|
Loading…
Reference in a new issue