Skip to content

Commit

Permalink
wallet: skip rescan if address batch is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
benthecarman authored and guggero committed Dec 10, 2024
1 parent c0bc1e3 commit 7eaa2a6
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions wallet/rescan.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,21 @@ out:
// Log the newly-started rescan.
numAddrs := len(batch.addrs)
noun := pickNoun(numAddrs, "address", "addresses")
log.Infof("Started rescan from block %v (height %d) for %d %s",
batch.bs.Hash, batch.bs.Height, numAddrs, noun)
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 numAddrs == 0 {
batch.done(nil)
continue
}

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

0 comments on commit 7eaa2a6

Please sign in to comment.