Rescan failure logging (#4250)

* Rescan failure

* Set rescanning to false inFailure case
This commit is contained in:
Chris Stewart 2022-04-10 10:39:11 -05:00 committed by GitHub
parent a2587677c3
commit 7c1c572081
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,7 @@ import org.bitcoins.wallet.{Wallet, WalletLogger}
import java.util.concurrent.atomic.AtomicBoolean
import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success}
private[wallet] trait RescanHandling extends WalletLogger {
self: Wallet =>
@ -80,12 +81,15 @@ private[wallet] trait RescanHandling extends WalletLogger {
RescanState.RescanDone
}
res.onComplete { _ =>
rescanning.set(false)
logger.info(
s"Finished rescanning the wallet. It took ${System.currentTimeMillis() - start}ms")
res.onComplete {
case Success(_) =>
rescanning.set(false)
logger.info(
s"Finished rescanning the wallet. It took ${System.currentTimeMillis() - start}ms")
case Failure(err) =>
rescanning.set(false)
logger.error(s"Failed to rescan wallet", err)
}
res
}
}