From 5c69110f475f5b6195e66973731fa1a383355e34 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 21 Sep 2017 16:14:39 -0600 Subject: [PATCH] wallet: ensure rescan is launched with all addresses During the time of initial block hash catch-up, it is possible to request an address be generated. This commit updates the active addresses by calling `w.activeData` after the catch-up is complete. --- wallet/wallet.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/wallet/wallet.go b/wallet/wallet.go index dab4e8a..6388008 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -453,6 +453,19 @@ func (w *Wallet) syncWithChain() error { return err } log.Info("Done catching up block hashes") + + // Since we've spent some time catching up block hashes, we + // might have new addresses waiting for us that were requested + // during initial sync. Make sure we have those before we + // request a rescan later on. + err = walletdb.View(w.db, func(dbtx walletdb.ReadTx) error { + var err error + addrs, unspent, err = w.activeData(dbtx) + return err + }) + if err != nil { + return err + } } // Compare previously-seen blocks against the chain server. If any of