From a792319795563fdcb14e03c6da18ee09fe8b6db9 Mon Sep 17 00:00:00 2001 From: benthecarman Date: Fri, 28 Oct 2022 22:06:15 -0500 Subject: [PATCH] wallet: skip rescan if address batch is empty --- wallet/rescan.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/wallet/rescan.go b/wallet/rescan.go index 6ead082da8..50ff90b532 100644 --- a/wallet/rescan.go +++ b/wallet/rescan.go @@ -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 }