wallet: add logging when catching up block hashes on startup/rescan

This commit is contained in:
Alex 2017-07-11 18:04:36 -06:00 committed by Olaoluwa Osuntokun
parent 3eb28d2d37
commit 4fb78bca18
2 changed files with 10 additions and 0 deletions

View file

@ -192,6 +192,8 @@ out:
// if it doesn't match the original hash returned by
// the notification, to roll back and restart the
// rescan.
log.Infof("Catching up block hashes to height %d, this"+
" might take a while", n.Height)
err := walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error {
ns := tx.ReadWriteBucket(waddrmgrNamespaceKey)
startBlock := w.Manager.SyncedTo()
@ -216,6 +218,7 @@ out:
"sync state for hash %v (height %d): %v",
n.Hash, n.Height, err)
}
log.Info("Done catching up block hashes")
case msg := <-w.rescanFinished:
n := msg.Notification
@ -242,6 +245,8 @@ out:
// if it doesn't match the original hash returned by
// the notification, to roll back and restart the
// rescan.
log.Infof("Catching up block hashes to height %d, this"+
" might take a while", n.Height)
err := walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error {
ns := tx.ReadWriteBucket(waddrmgrNamespaceKey)
startBlock := w.Manager.SyncedTo()
@ -269,6 +274,7 @@ out:
}
w.SetChainSynced(true)
log.Info("Done catching up block hashes")
go w.resendUnminedTxs()
case <-quit:

View file

@ -356,6 +356,8 @@ func (w *Wallet) syncWithChain() error {
if err != nil {
return err
}
log.Infof("Catching up block hashes to height %d, this will "+
"take a while...", bestHeight)
// Initialize the first database transaction.
tx, err := w.db.BeginReadWriteTx()
if err != nil {
@ -383,6 +385,7 @@ func (w *Wallet) syncWithChain() error {
tx.Rollback()
return err
}
log.Infof("Caught up to height %d", height)
tx, err = w.db.BeginReadWriteTx()
if err != nil {
return err
@ -396,6 +399,7 @@ func (w *Wallet) syncWithChain() error {
tx.Rollback()
return err
}
log.Info("Done catching up block hashes")
}
// Compare previously-seen blocks against the chain server. If any of