Skip to content

Commit

Permalink
Skip rescan if address batch is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman committed Oct 29, 2022
1 parent 58c2680 commit 69caf7a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions wallet/rescan.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,17 @@ out:
log.Infof("Started rescan from block %v (height %d) for %d %s",
batch.bs.Hash, batch.bs.Height, numAddrs, noun)

err := chainClient.Rescan(&batch.bs.Hash, batch.addrs,
batch.outpoints)
if err != nil {
log.Errorf("Rescan for %d %s failed: %v", numAddrs,
noun, err)
if numAddrs > 0 {
err := chainClient.Rescan(&batch.bs.Hash, batch.addrs,
batch.outpoints)
if err != nil {
log.Errorf("Rescan for %d %s failed: %v", numAddrs,
noun, err)
}
batch.done(err)
} else {
batch.done(nil)
}
batch.done(err)
case <-quit:
break out
}
Expand Down

0 comments on commit 69caf7a

Please sign in to comment.